Bug #67741 [NEW]: auto_prepend_file messes up __LINE__

From: Date: Sat, 02 Aug 2014 00:02:33 +0000
Subject: Bug #67741 [NEW]: auto_prepend_file messes up __LINE__
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-186932@lists.php.net to get a copy of this message
From: dwilks at intacct dot com Operating system: OSX 10.9.4 PHP version: 5.4.31 Package: CGI/CLI related Bug Type: Bug Bug description:auto_prepend_file messes up __LINE__ 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 -- Edit bug report at https://bugs.php.net/bug.php?id=67741&edit=1 --

« previous php.bugs (#186932) next »