From b009573f4e2f085208f583faffc050746d5d363e Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Tue, 3 Nov 2020 16:24:54 +0100 Subject: [PATCH] Report parse errors during preloading --- ext/opcache/ZendAccelerator.c | 4 ++++ ext/opcache/tests/preload_parse_error.inc | 2 ++ ext/opcache/tests/preload_parse_error.phpt | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) create mode 100644 ext/opcache/tests/preload_parse_error.inc create mode 100644 ext/opcache/tests/preload_parse_error.phpt 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 @@ + +--FILE-- +OK +--EXPECTF-- +Parse error: syntax error, unexpected identifier "error" in %s on line %d -- 2.40.0