mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
Merge branch 'PHP-5.6'
* PHP-5.6: Fixed bug #67741 (auto_prepend_file messes up __LINE__) Conflicts: main/main.c
This commit is contained in:
commit
c6e415aeb2
15
main/main.c
15
main/main.c
@ -2524,8 +2524,21 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file)
|
||||
#endif
|
||||
zend_set_timeout(INI_INT("max_execution_time"), 0);
|
||||
}
|
||||
retval = (zend_execute_scripts(ZEND_REQUIRE, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS);
|
||||
|
||||
{
|
||||
/*
|
||||
If cli primary file has shabang line and there is a prepend file,
|
||||
the `start_lineno` will be used by prepend file but not primary file,
|
||||
save it and restore after prepend file been executed.
|
||||
*/
|
||||
int orig_start_lineno = CG(start_lineno);
|
||||
|
||||
CG(start_lineno) = 0;
|
||||
retval = (zend_execute_scripts(ZEND_REQUIRE, NULL, 1, prepend_file_p) == SUCCESS);
|
||||
CG(start_lineno) = orig_start_lineno;
|
||||
|
||||
retval = retval && (zend_execute_scripts(ZEND_REQUIRE, NULL, 2, primary_file, append_file_p) == SUCCESS);
|
||||
}
|
||||
} zend_end_try();
|
||||
|
||||
#if HAVE_BROKEN_GETCWD
|
||||
|
17
sapi/cli/tests/bug67741.phpt
Normal file
17
sapi/cli/tests/bug67741.phpt
Normal file
@ -0,0 +1,17 @@
|
||||
--TEST--
|
||||
Bug #67741 (auto_prepend_file messes up __LINE__)
|
||||
--INI--
|
||||
include_path={PWD}
|
||||
auto_prepend_file=bug67741_stub.inc
|
||||
--SKIPIF--
|
||||
<?php
|
||||
include "skipif.inc";
|
||||
?>
|
||||
--FILE--
|
||||
#!/bin/env php
|
||||
<?php
|
||||
echo "primary lineno: ", __LINE__, "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
prepend lineno: 2
|
||||
primary lineno: 3
|
3
sapi/cli/tests/bug67741_stub.inc
Normal file
3
sapi/cli/tests/bug67741_stub.inc
Normal file
@ -0,0 +1,3 @@
|
||||
<?php
|
||||
echo "prepend lineno: ", __LINE__, "\n";
|
||||
?>
|
Loading…
Reference in New Issue
Block a user