PHP 5.4.4 Build Date Nov 21 2016 03:23:06 running on z/OS 2.2 under Apache V9.
It seems that PHP does not take into account the she-bang on the first line when reporting the line number in error, therefore it is always one less than its actual location in the script. The following example code contains a syntax error on line 7:
000001 #!/path/to/php/php-cgi
000002 <?php
000003
000004 $v = “A value”;
000005
000006 // The following line contains a syntax error
000007 $a = arra();
000008
000009 ?>
When run in the browser the following message is displayed:
Fatal error: Call to undefined function arra() in /my/cgi on line 6
Notice that the reported line number is “6” when the actual error occurs on source line “7”.
If the same script is run using PHP 5.1.2 (previously supplied by IBM) then this message is displayed:
Fatal error: HPH01209 Call to undefined function arra() in /my/cgi on line 7
Now the correct line number is displayed.
I guess it’s debatable as to whether or not the she-bang should be counted when calculating the line number but it sure makes debugging easier if the reported line number matches the source exactly.
Any chance that this could be changed or is there a setting somewhere to make it happen?
Thanks.