Skip to content

Commit 36a8cf5

Browse files
committed
Fixed bug #78514
The property class may have already been translated as part of some other class. Only translate if xlat returns non-null.
1 parent 66caca5 commit 36a8cf5

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ PHP NEWS
77

88
- Opcache:
99
. Add opcache.preload_user INI directive. (Dmitry)
10+
. Fixed bug #78514 (Preloading segfaults with inherited typed property).
11+
(Nikita)
1012

1113
- PCRE:
1214
. Fixed bug #78349 (Bundled pcre2 library missing LICENCE file). (Peter Kokot)

ext/opcache/tests/preload.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ class Z {
4343
public a $bar;
4444
}
4545

46+
class Z2 extends Z {}
47+
4648
function get_anon() {
4749
return new class {};
4850
}

ext/opcache/zend_persist.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,9 @@ static void zend_update_parent_ce(zend_class_entry *ce)
931931
zend_class_entry *ce = ZEND_TYPE_CE(prop->type);
932932
if (ce->type == ZEND_USER_CLASS) {
933933
ce = zend_shared_alloc_get_xlat_entry(ce);
934-
ZEND_ASSERT(ce);
935-
prop->type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(prop->type));
934+
if (ce) {
935+
prop->type = ZEND_TYPE_ENCODE_CE(ce, ZEND_TYPE_ALLOW_NULL(prop->type));
936+
}
936937
}
937938
}
938939
} ZEND_HASH_FOREACH_END();

0 commit comments

Comments
 (0)