Don't assume that handlers live in the arena, they may also be in
SHM.
This commit is contained in:
Nikita Popov 2019-12-18 11:37:39 +01:00
parent 203308f6c3
commit bd4fce4f6f
3 changed files with 31 additions and 1 deletions

2
NEWS
View File

@ -14,6 +14,8 @@ PHP NEWS
. Fixed bug #78950 (Preloading trait method with static variables). (Nikita)
. Fixed bug #78903 (Conflict in RTD key for closures results in crash).
(Nikita)
. Fixed bug #78986 (Opcache segfaults when inheriting ctor from immutable
into mutable class). (Nikita)
- Spl:
. Fixed bug #78976 (SplFileObject::fputcsv returns -1 on failure). (cmb)

View File

@ -0,0 +1,28 @@
--TEST--
Bug #78986: Opcache segfaults when inheriting ctor from immutable into mutable class
--FILE--
<?php
define('TEST_TEST', 1);
class TestClass2 {
function __construct() {}
}
class TestClass extends TestClass2 {
var $test = [
TEST_TEST => 'test'
];
}
var_dump(new TestClass());
?>
--EXPECT--
object(TestClass)#1 (1) {
["test"]=>
array(1) {
[1]=>
string(4) "test"
}
}

View File

@ -246,7 +246,7 @@ static void zend_hash_clone_prop_info(HashTable *ht)
#define zend_update_inherited_handler(handler) \
{ \
if (ce->handler != NULL) { \
if (ce->handler != NULL && IN_ARENA(ce->handler)) { \
ce->handler = ARENA_REALLOC(ce->handler); \
} \
}