diff --git a/Zend/tests/property_hooks/gh19548.phpt b/Zend/tests/property_hooks/gh19548.phpt new file mode 100644 index 0000000000000..d34ed0a74bb2f --- /dev/null +++ b/Zend/tests/property_hooks/gh19548.phpt @@ -0,0 +1,19 @@ +--TEST-- +GH-19548: Segfault when using inherited properties and opcache +--FILE-- + +--EXPECT-- +Test passed - no segmentation fault diff --git a/Zend/tests/property_hooks/gh19548_002.phpt b/Zend/tests/property_hooks/gh19548_002.phpt new file mode 100644 index 0000000000000..bba006b81032e --- /dev/null +++ b/Zend/tests/property_hooks/gh19548_002.phpt @@ -0,0 +1,29 @@ +--TEST-- +GH-19548: Segfault when using inherited properties and opcache (multiple properties) +--FILE-- + +--EXPECT-- +Multiple property test passed - no segmentation fault diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c index bbc7a767e1b2f..8679a53e8ff59 100644 --- a/Zend/zend_inheritance.c +++ b/Zend/zend_inheritance.c @@ -1564,7 +1564,9 @@ static void do_inherit_property(zend_property_info *parent_info, zend_string *ke ZSTR_VAL(parent_info->ce->name)); } - child_info->flags &= ~ZEND_ACC_OVERRIDE; + if (child_info->ce == ce) { + child_info->flags &= ~ZEND_ACC_OVERRIDE; + } } } else { zend_function **hooks = parent_info->hooks;