Skip to content

Commit be7e819

Browse files
committed
Fixed bug #77922
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.
1 parent a192499 commit be7e819

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ PHP NEWS
22
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
33
?? ??? ????, PHP 7.3.10
44

5+
- Core:
6+
. Fixed bug #77922 (Double release of doc comment on inherited shadow
7+
property). (Nikita)
8+
59
- Intl:
610
. Ensure IDNA2003 rules are used with idn_to_ascii() and idn_to_utf8()
711
when requested. (Sara)

Zend/tests/bug77922.phpt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
--TEST--
2+
Bug #77922: Double release of doc comment on inherited shadow property
3+
--FILE--
4+
<?php
5+
6+
class A {
7+
/** Foo */
8+
private $prop;
9+
}
10+
11+
class B extends A {
12+
}
13+
14+
class C extends B {
15+
}
16+
17+
?>
18+
===DONE===
19+
--EXPECT--
20+
===DONE===

Zend/zend_opcode.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,8 @@ ZEND_API void destroy_zend_class(zval *zv)
235235
efree(ce->default_static_members_table);
236236
}
237237
ZEND_HASH_FOREACH_PTR(&ce->properties_info, prop_info) {
238-
if (prop_info->ce == ce || (prop_info->flags & ZEND_ACC_SHADOW)) {
238+
if (prop_info->ce == ce ||
239+
((prop_info->flags & ZEND_ACC_SHADOW) && prop_info->ce == ce->parent)) {
239240
zend_string_release_ex(prop_info->name, 0);
240241
if (prop_info->doc_comment) {
241242
zend_string_release_ex(prop_info->doc_comment, 0);

0 commit comments

Comments
 (0)