Skip to content

Commit bd4fce4

Browse files
committed
Fixed bug #78986
Don't assume that handlers live in the arena, they may also be in SHM.
1 parent 203308f commit bd4fce4

File tree

3 files changed

+31
-1
lines changed

3 files changed

+31
-1
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ PHP NEWS
1414
. Fixed bug #78950 (Preloading trait method with static variables). (Nikita)
1515
. Fixed bug #78903 (Conflict in RTD key for closures results in crash).
1616
(Nikita)
17+
. Fixed bug #78986 (Opcache segfaults when inheriting ctor from immutable
18+
into mutable class). (Nikita)
1719

1820
- Spl:
1921
. Fixed bug #78976 (SplFileObject::fputcsv returns -1 on failure). (cmb)

ext/opcache/tests/bug78986.phpt

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
--TEST--
2+
Bug #78986: Opcache segfaults when inheriting ctor from immutable into mutable class
3+
--FILE--
4+
<?php
5+
6+
define('TEST_TEST', 1);
7+
8+
class TestClass2 {
9+
function __construct() {}
10+
}
11+
12+
class TestClass extends TestClass2 {
13+
var $test = [
14+
TEST_TEST => 'test'
15+
];
16+
}
17+
18+
var_dump(new TestClass());
19+
20+
?>
21+
--EXPECT--
22+
object(TestClass)#1 (1) {
23+
["test"]=>
24+
array(1) {
25+
[1]=>
26+
string(4) "test"
27+
}
28+
}

ext/opcache/zend_accelerator_util_funcs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ static void zend_hash_clone_prop_info(HashTable *ht)
246246

247247
#define zend_update_inherited_handler(handler) \
248248
{ \
249-
if (ce->handler != NULL) { \
249+
if (ce->handler != NULL && IN_ARENA(ce->handler)) { \
250250
ce->handler = ARENA_REALLOC(ce->handler); \
251251
} \
252252
}

0 commit comments

Comments
 (0)