]> granicus.if.org Git - php/commitdiff
Merge branch 'PHP-5.6'
authorReeze Xia <reeze@php.net>
Tue, 3 Mar 2015 03:44:52 +0000 (11:44 +0800)
committerReeze Xia <reeze@php.net>
Tue, 3 Mar 2015 03:44:52 +0000 (11:44 +0800)
* PHP-5.6:
  Fixed bug #67741 (auto_prepend_file messes up __LINE__)

Conflicts:
main/main.c

1  2 
main/main.c

diff --cc main/main.c
index f74190cf0627a6d2a1444f5eba0c354b11fd4de8,8a2c48dcd22944de6286062d2caada1d3a4852d4..4bcf6989e90e621132b5450becbe64e004a9baf6
@@@ -2524,8 -2579,21 +2524,21 @@@ PHPAPI int php_execute_script(zend_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);
  
 -                      retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 1, prepend_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 = retval && (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 2, primary_file, append_file_p) == SUCCESS);
++                      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