@@ -2508,19 +2508,21 @@ PHPAPI int php_execute_script(zend_file_handle *primary_file TSRMLS_DC)
2508
2508
zend_set_timeout (INI_INT ("max_execution_time" ), 0 );
2509
2509
}
2510
2510
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 ) {
2517
2517
int orig_start_lineno = CG (start_lineno );
2518
2518
2519
2519
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 );
2524
2526
}
2525
2527
} zend_end_try ();
2526
2528
0 commit comments