PHP :: Bug #67741 :: auto_prepend_file messes up __LINE__
[2014-08-02 00:02 UTC] dwilks at intacct dot com
Description: ------------ In scripts that begin with a shebang (#!) line, __LINE__ is off-by-one when an auto_prepend_file is configured and is correct without an auto_prepend_file. This happens when the script is executed by the shell or by passing it to php with the -f parameter. I assume this is happening because auto_prepend_file is triggering a call to zend_language_scanner:compile_file before the main script is compiled. This causes the auto-prepended-file to trigger open_file_for_scanning's processing of start_lineno that is set in the cli sapi and by the time the main script is compiled start_lineno has been cleared. This is pretty similar to https://bugs.php.net/bug.php?id=54081. Test script: --------------- #!/usr/local/php5/bin/php -q <?php echo "Line 3 is really line " . __LINE__ . "\n"; Expected result: ---------------- Line 3 is really line 3 Actual result: -------------- Line 3 is really line 2
[2015-03-03 03:47 UTC] reeze@php.net
-Status: Open +Status: Closed