In PHP 7.3 shadow properties are no longer duplicated. Make sure we
only release them if the property was defined on the parent class,
which means that it changed from private->shadow, which is where
duplication does happen.
This commit is contained in:
Nikita Popov 2019-08-17 10:57:26 +02:00
parent a192499d2a
commit be7e819068
3 changed files with 26 additions and 1 deletions

4
NEWS
View File

@ -2,6 +2,10 @@ PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? ????, PHP 7.3.10
- Core:
. Fixed bug #77922 (Double release of doc comment on inherited shadow
property). (Nikita)
- Intl:
. Ensure IDNA2003 rules are used with idn_to_ascii() and idn_to_utf8()
when requested. (Sara)

20
Zend/tests/bug77922.phpt Normal file
View File

@ -0,0 +1,20 @@
--TEST--
Bug #77922: Double release of doc comment on inherited shadow property
--FILE--
<?php
class A {
/** Foo */
private $prop;
}
class B extends A {
}
class C extends B {
}
?>
===DONE===
--EXPECT--
===DONE===

View File

@ -235,7 +235,8 @@ ZEND_API void destroy_zend_class(zval *zv)
efree(ce->default_static_members_table);
}
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
if (prop_info->ce == ce || (prop_info->flags & ZEND_ACC_SHADOW)) {
if (prop_info->ce == ce ||
((prop_info->flags & ZEND_ACC_SHADOW) && prop_info->ce == ce->parent)) {
zend_string_release_ex(prop_info->name, 0);
if (prop_info->doc_comment) {
zend_string_release_ex(prop_info->doc_comment, 0);