Bug #67741 [Opn->Csd]: auto_prepend_file messes up __LINE__
| From: | reeze@php.net | Date: | Tue, 03 Mar 2015 03:47:04 +0000 |
| Subject: | Bug #67741 [Opn->Csd]: auto_prepend_file messes up __LINE__ | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-191067@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67741&edit=1
ID: 67741
Updated by: reeze@php.net
Reported by: dwilks at intacct dot com
Summary: auto_prepend_file messes up __LINE__
-Status: Open
+Status: Closed
Type: Bug
Package: CGI/CLI related
Operating System: OSX 10.9.4
PHP Version: 5.4.31
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of reeze
Revision: http://git.php.net/?p=php-src.git;a=commit;h=34f09b62408759e9d8754ccdd790c6586507a4d2
Log: Fixed bug #67741 (auto_prepend_file messes up __LINE__)
Previous Comments:
------------------------------------------------------------------------
[2014-08-02 00:02:32] 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
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67741&edit=1