Skip to content

Commit 860fc39

Browse files
committed
Improve fix for bug 67741
Thanks to laruence.
1 parent bb466d5 commit 860fc39

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

main/main.c

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2508,19 +2508,21 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
25082508
zend_set_timeout(INI_INT("max_execution_time"), 0);
25092509
}
25102510

2511-
{
2512-
/*
2513-
If cli primary file has shabang line and there is a prepend file,
2514-
the `start_lineno` will be used by prepend file but not primary file,
2515-
save it and restore after prepend file been executed.
2516-
*/
2511+
/*
2512+
If cli primary file has shabang line and there is a prepend file,
2513+
the `start_lineno` will be used by prepend file but not primary file,
2514+
save it and restore after prepend file been executed.
2515+
*/
2516+
if (CG(start_lineno) && prepend_file_p) {
25172517
int orig_start_lineno = CG(start_lineno);
25182518

25192519
CG(start_lineno) = 0;
2520-
retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 1, prepend_file_p) == SUCCESS);
2521-
CG(start_lineno) = orig_start_lineno;
2522-
2523-
retval = retval && (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 2, primary_file, append_file_p) == SUCCESS);
2520+
if (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 1, prepend_file_p) == SUCCESS) {
2521+
CG(start_lineno) = orig_start_lineno;
2522+
retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 2, primary_file, append_file_p) == SUCCESS);
2523+
}
2524+
} else {
2525+
retval = (zend_execute_scripts(ZEND_REQUIRE TSRMLS_CC, NULL, 3, prepend_file_p, primary_file, append_file_p) == SUCCESS);
25242526
}
25252527
} zend_end_try();
25262528

0 commit comments

Comments
 (0)