I just narrowed down one of these strange errors that just occurs at certain environments.
The code below parses ok on my linux php 5.3.6 default install, on windows php 5.4.3 default install but fails on some of the windows machines we have with Windows php 5.3.6.
The message we get is:
Parse error: syntax error, unexpected ‘}’ in C:\bogus.php on line 7
The line 7 is the “}”.
I can only think this error is caused by a php.ini setting. Does anybody know what the problem is?
<?php
if(!empty($data['foo'])) {
?>
<div>
<?=$data['bar'];if(!empty($data['foo'])) {?> (Foo: <?=$data['foo'];?>) <?php }?></div>
<?php
}
?>
This looks strange:
You are mixing
<?=with multiple statements. I would try to avoid the short tag here if I were you.But regardless, I think this means that the windows machines does NOT have
short_open_tagsenabled in php.ini. Enable it and your problems will probably go away.