Merge branch 'PHP-7.4' into PHP-8.0

* PHP-7.4:
  Fixed bug #81353
This commit is contained in:
Nikita Popov 2021-08-16 15:04:26 +02:00
commit 47ccdecf00
5 changed files with 47 additions and 0 deletions

4
NEWS
View File

@ -7,6 +7,10 @@ PHP NEWS
. Fixed bug #81346 (Non-seekable streams don't update position after write).
(cmb)
- Opcache:
. Fixed bug #81353 (segfault with preloading and statically bound closure).
(Nikita)
- XML:
. Fixed bug #81351 (xml_parse may fail, but has no error code). (cmb, Nikita)

View File

@ -4599,6 +4599,20 @@ static int accel_preload(const char *config, zend_bool in_child)
}
} ZEND_HASH_FOREACH_END();
if (Z_TYPE(EG(user_error_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_error_handler));
ZVAL_UNDEF(&EG(user_error_handler));
}
if (Z_TYPE(EG(user_exception_handler)) != IS_UNDEF) {
zval_ptr_dtor(&EG(user_exception_handler));
ZVAL_UNDEF(&EG(user_exception_handler));
}
zend_stack_clean(&EG(user_error_handlers_error_reporting), NULL, 1);
zend_stack_clean(&EG(user_error_handlers), (void (*)(void *))ZVAL_PTR_DTOR, 1);
zend_stack_clean(&EG(user_exception_handlers), (void (*)(void *))ZVAL_PTR_DTOR, 1);
CG(map_ptr_last) = orig_map_ptr_last;
if (EG(full_tables_cleanup)) {

View File

@ -0,0 +1,8 @@
<?php
set_error_handler(function($_, $m) {
static $x;
var_dump($m);
});
opcache_compile_file(__DIR__ . '/preload_error_handler_ind.inc');

View File

@ -0,0 +1,17 @@
--TEST--
Bug #81353: Segfault with preloading and error handler using static variables
--INI--
opcache.enable=1
opcache.enable_cli=1
opcache.optimization_level=-1
opcache.preload={PWD}/preload_error_handler.inc
--SKIPIF--
<?php
require_once('skipif.inc');
if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows');
?>
--FILE--
===DONE===
--EXPECTF--
Warning: Can't preload unlinked class B: Unknown parent A in %s on line %d
===DONE===

View File

@ -0,0 +1,4 @@
<?php
// Cause a preload warning
class B extends A {}