com php-src: Stop PHP in case of fatal error during preloading: ext/opcache/ZendAccelerator.c

From: Date: Tue, 19 Feb 2019 13:46:56 +0000
Subject: com php-src: Stop PHP in case of fatal error during preloading: ext/opcache/ZendAccelerator.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-104731@lists.php.net to get a copy of this message
Commit: 440cdf7837d7eb99dc292542672f8107b92ee1ec Author: Dmitry Stogov <dmitry@zend.com> Tue, 19 Feb 2019 16:46:56 +0300 Parents: eb03df813c303213ccd0eefa640cf63699be8138 Branches: PHP-7.4 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=440cdf7837d7eb99dc292542672f8107b92ee1ec Log: Stop PHP in case of fatal error during preloading Changed paths: M ext/opcache/ZendAccelerator.c Diff: diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 7a4d0f2..3c61782 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -32,6 +32,7 @@ #include "zend_list.h" #include "zend_execute.h" #include "zend_inheritance.h" +#include "zend_exceptions.h" #include "main/php_main.h" #include "main/SAPI.h" #include "main/php_streams.h" @@ -3845,7 +3846,29 @@ static int accel_preload(const char *config) zend_hash_init(preload_scripts, 0, NULL, NULL, 0); zend_try { - ret = zend_execute_scripts(ZEND_REQUIRE, NULL, 1, &file_handle); + zend_op_array *op_array; + + ret = SUCCESS; + op_array = zend_compile_file(&file_handle, ZEND_REQUIRE); + if (file_handle.opened_path) { + zend_hash_add_empty_element(&EG(included_files), file_handle.opened_path); + } + zend_destroy_file_handle(&file_handle); + if (op_array) { + zend_execute(op_array, NULL); + zend_exception_restore(); + zend_try_exception_handler(); + if (EG(exception)) { + zend_exception_error(EG(exception), E_ERROR); + CG(unclean_shutdown) = 1; + ret = FAILURE; + } + destroy_op_array(op_array); + efree_size(op_array, sizeof(zend_op_array)); + } else { + CG(unclean_shutdown) = 1; + ret = FAILURE; + } } zend_catch { ret = FAILURE; } zend_end_try();

« previous php.cvs (#104731) next »