diff options
author | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-03 16:24:54 +0100 |
---|---|---|
committer | Nikita Popov <nikita.ppv@gmail.com> | 2020-11-03 16:24:54 +0100 |
commit | b009573f4e2f085208f583faffc050746d5d363e (patch) | |
tree | 6d9b91086c7186f32f4f85a1f57a62b8ce0926e2 /ext | |
parent | 9fd8e00f1a90acd5e23bfcb6f8b0217187bcfb1d (diff) | |
download | php-git-b009573f4e2f085208f583faffc050746d5d363e.tar.gz |
Report parse errors during preloading
Diffstat (limited to 'ext')
-rw-r--r-- | ext/opcache/ZendAccelerator.c | 4 | ||||
-rw-r--r-- | ext/opcache/tests/preload_parse_error.inc | 2 | ||||
-rw-r--r-- | ext/opcache/tests/preload_parse_error.phpt | 16 |
3 files changed, 22 insertions, 0 deletions
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 5f1d80c083..4d2fbb7130 100644 --- a/ext/opcache/ZendAccelerator.c +++ b/ext/opcache/ZendAccelerator.c @@ -4480,6 +4480,10 @@ static int accel_preload(const char *config, zend_bool in_child) destroy_op_array(op_array); efree_size(op_array, sizeof(zend_op_array)); } else { + if (EG(exception)) { + zend_exception_error(EG(exception), E_ERROR); + } + CG(unclean_shutdown) = 1; ret = FAILURE; } diff --git a/ext/opcache/tests/preload_parse_error.inc b/ext/opcache/tests/preload_parse_error.inc new file mode 100644 index 0000000000..08b9d7799c --- /dev/null +++ b/ext/opcache/tests/preload_parse_error.inc @@ -0,0 +1,2 @@ +<?php +parse error diff --git a/ext/opcache/tests/preload_parse_error.phpt b/ext/opcache/tests/preload_parse_error.phpt new file mode 100644 index 0000000000..b1ad812447 --- /dev/null +++ b/ext/opcache/tests/preload_parse_error.phpt @@ -0,0 +1,16 @@ +--TEST-- +Parse error in preload script +--INI-- +opcache.enable=1 +opcache.enable_cli=1 +opcache.optimization_level=-1 +opcache.preload={PWD}/preload_parse_error.inc +--SKIPIF-- +<?php +require_once('skipif.inc'); +if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows'); +?> +--FILE-- +OK +--EXPECTF-- +Parse error: syntax error, unexpected identifier "error" in %s on line %d |