@@ -1865,12 +1865,40 @@ ZEND_API ZEND_COLD void zend_user_exception_handler(void) /* {{{ */
18651865 zval_ptr_dtor (& orig_user_exception_handler );
18661866} /* }}} */
18671867
1868+ ZEND_API zend_result zend_execute_script (int type , zval * retval , zend_file_handle * file_handle )
1869+ {
1870+ zend_op_array * op_array = zend_compile_file (file_handle , type );
1871+ if (file_handle -> opened_path ) {
1872+ zend_hash_add_empty_element (& EG (included_files ), file_handle -> opened_path );
1873+ }
1874+
1875+ zend_result ret = SUCCESS ;
1876+ if (op_array ) {
1877+ zend_execute (op_array , retval );
1878+ zend_exception_restore ();
1879+ if (UNEXPECTED (EG (exception ))) {
1880+ if (Z_TYPE (EG (user_exception_handler )) != IS_UNDEF ) {
1881+ zend_user_exception_handler ();
1882+ }
1883+ if (EG (exception )) {
1884+ ret = zend_exception_error (EG (exception ), E_ERROR );
1885+ }
1886+ }
1887+ zend_destroy_static_vars (op_array );
1888+ destroy_op_array (op_array );
1889+ efree_size (op_array , sizeof (zend_op_array ));
1890+ } else if (type == ZEND_REQUIRE ) {
1891+ ret = FAILURE ;
1892+ }
1893+
1894+ return ret ;
1895+ }
1896+
18681897ZEND_API zend_result zend_execute_scripts (int type , zval * retval , int file_count , ...) /* {{{ */
18691898{
18701899 va_list files ;
18711900 int i ;
18721901 zend_file_handle * file_handle ;
1873- zend_op_array * op_array ;
18741902 zend_result ret = SUCCESS ;
18751903
18761904 va_start (files , file_count );
@@ -1879,32 +1907,10 @@ ZEND_API zend_result zend_execute_scripts(int type, zval *retval, int file_count
18791907 if (!file_handle ) {
18801908 continue ;
18811909 }
1882-
18831910 if (ret == FAILURE ) {
18841911 continue ;
18851912 }
1886-
1887- op_array = zend_compile_file (file_handle , type );
1888- if (file_handle -> opened_path ) {
1889- zend_hash_add_empty_element (& EG (included_files ), file_handle -> opened_path );
1890- }
1891- if (op_array ) {
1892- zend_execute (op_array , retval );
1893- zend_exception_restore ();
1894- if (UNEXPECTED (EG (exception ))) {
1895- if (Z_TYPE (EG (user_exception_handler )) != IS_UNDEF ) {
1896- zend_user_exception_handler ();
1897- }
1898- if (EG (exception )) {
1899- ret = zend_exception_error (EG (exception ), E_ERROR );
1900- }
1901- }
1902- zend_destroy_static_vars (op_array );
1903- destroy_op_array (op_array );
1904- efree_size (op_array , sizeof (zend_op_array ));
1905- } else if (type == ZEND_REQUIRE ) {
1906- ret = FAILURE ;
1907- }
1913+ ret = zend_execute_script (type , retval , file_handle );
19081914 }
19091915 va_end (files );
19101916
0 commit comments