@@ -2525,19 +2525,21 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file)
25252525 zend_set_timeout (INI_INT ("max_execution_time" ), 0 );
25262526 }
25272527
2528- {
2529- /*
2530- If cli primary file has shabang line and there is a prepend file,
2531- the `start_lineno` will be used by prepend file but not primary file,
2532- save it and restore after prepend file been executed.
2533- */
2528+ /*
2529+ If cli primary file has shabang line and there is a prepend file,
2530+ the `start_lineno` will be used by prepend file but not primary file,
2531+ save it and restore after prepend file been executed.
2532+ */
2533+ if ( CG ( start_lineno ) && prepend_file_p ) {
25342534 int orig_start_lineno = CG (start_lineno );
25352535
25362536 CG (start_lineno ) = 0 ;
2537- retval = (zend_execute_scripts (ZEND_REQUIRE , NULL , 1 , prepend_file_p ) == SUCCESS );
2538- CG (start_lineno ) = orig_start_lineno ;
2539-
2540- retval = retval && (zend_execute_scripts (ZEND_REQUIRE , NULL , 2 , primary_file , append_file_p ) == SUCCESS );
2537+ if (zend_execute_scripts (ZEND_REQUIRE , NULL , 1 , prepend_file_p ) == SUCCESS ) {
2538+ CG (start_lineno ) = orig_start_lineno ;
2539+ retval = (zend_execute_scripts (ZEND_REQUIRE , NULL , 2 , primary_file , append_file_p ) == SUCCESS );
2540+ }
2541+ } else {
2542+ retval = (zend_execute_scripts (ZEND_REQUIRE , NULL , 3 , prepend_file_p , primary_file , append_file_p ) == SUCCESS );
25412543 }
25422544 } zend_end_try ();
25432545
0 commit comments