com php-src: Report parse errors during preloading: ext/opcache/ZendAccelerator.c ext/opcache/tests/preload_parse _error.inc
ext/opcache/tests/preload_parse_error.ph pt

From: Date: Tue, 03 Nov 2020 15:24:54 +0000
Subject: com php-src: Report parse errors during preloading: ext/opcache/ZendAccelerator.c ext/opcache/tests/preload_parse _error.inc
ext/opcache/tests/preload_parse_error.ph pt
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-114052@lists.php.net to get a copy of this message
Commit: b009573f4e2f085208f583faffc050746d5d363e Author: Nikita Popov <nikita.ppv@gmail.com> Tue, 3 Nov 2020 16:24:54 +0100 Parents: 9fd8e00f1a90acd5e23bfcb6f8b0217187bcfb1d Branches: PHP-8.0 master Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=b009573f4e2f085208f583faffc050746d5d363e Log: Report parse errors during preloading Changed paths: M ext/opcache/ZendAccelerator.c A ext/opcache/tests/preload_parse_error.inc A ext/opcache/tests/preload_parse_error.phpt Diff: diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c index 5f1d80c0833..4d2fbb71303 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 00000000000..08b9d7799cd --- /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 00000000000..b1ad812447b --- /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

« previous php.cvs (#114052) next »