com php-src: Don't catch opcache_compile_file failures during preloading: ext/opcache/zend_accelerator_modul e.c
| From: | Nikita Popov | Date: | Mon, 18 Feb 2019 10:03:38 +0000 |
| Subject: | com php-src: Don't catch opcache_compile_file failures during preloading: ext/opcache/zend_accelerator_modul e.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104682@lists.php.net to get a copy of this message | ||
Commit: 2f3d61971ff9980a4f2c7b5255e226103b4e72bb
Author: Nikita Popov <nikita.ppv@gmail.com> Mon, 18 Feb 2019 10:44:50 +0100
Parents: cc0e01a2fad81ae87b5b2240ddd776e508e4c59a
Branches: PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2f3d61971ff9980a4f2c7b5255e226103b4e72bb
Log:
Don't catch opcache_compile_file failures during preloading
Compiler failures are not side-effect free, they may leave behind
parts of the file that were successfully compiled before the
failure occurred. The preloading code is not prepared to deal with
this.
Changed paths:
M ext/opcache/zend_accelerator_module.c
Diff:
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 65db851..f013fb9 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -843,12 +843,19 @@ static ZEND_FUNCTION(opcache_compile_file)
orig_compiler_options = CG(compiler_options);
CG(compiler_options) |= ZEND_COMPILE_WITHOUT_EXECUTION;
- zend_try {
+ if (CG(compiler_options) & ZEND_COMPILE_PRELOAD) {
+ /* During preloading, a failure in opcache_compile_file() should result in an overall
+ * preloading failure. Otherwise we may include partially compiled files in the preload
+ * state. */
op_array = persistent_compile_file(&handle, ZEND_INCLUDE);
- } zend_catch {
- EG(current_execute_data) = orig_execute_data;
- zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " could not compile file %s",
handle.filename);
- } zend_end_try();
+ } else {
+ zend_try {
+ op_array = persistent_compile_file(&handle, ZEND_INCLUDE);
+ } zend_catch {
+ EG(current_execute_data) = orig_execute_data;
+ zend_error(E_WARNING, ACCELERATOR_PRODUCT_NAME " could not compile file %s",
handle.filename);
+ } zend_end_try();
+ }
CG(compiler_options) = orig_compiler_options;