summaryrefslogtreecommitdiff
path: root/Zend/zend_inheritance.c
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-11-06 12:51:25 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-11-06 12:52:34 +0100
commit6d4965febdb1745444e7a3408fa7c01bcfc52b68 (patch)
treecaa407614c71d7b8ff9bb30135d2f7a4d1d97471 /Zend/zend_inheritance.c
parent4c9ba3e0428693a89cc4beff5c8773e97075880a (diff)
downloadphp-git-6d4965febdb1745444e7a3408fa7c01bcfc52b68.tar.gz
Fixed bug #78787
Not the first time inheritance of shadow properties causes an issue, thankfully this whole concept is gone in PHP 7.4.
Diffstat (limited to 'Zend/zend_inheritance.c')
-rw-r--r--Zend/zend_inheritance.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index 0b0cb314b6..d271b74154 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1595,10 +1595,14 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
/* next: check for conflicts with current class */
if ((coliding_prop = zend_hash_find_ptr(&ce->properties_info, prop_name)) != NULL) {
if (coliding_prop->flags & ZEND_ACC_SHADOW) {
- zend_string_release_ex(coliding_prop->name, 0);
- if (coliding_prop->doc_comment) {
- zend_string_release_ex(coliding_prop->doc_comment, 0);
- }
+ /* Only free if shadow is coming from direct parent,
+ * otherwise these weren't copied in the first place. */
+ if (coliding_prop->ce == ce->parent) {
+ zend_string_release_ex(coliding_prop->name, 0);
+ if (coliding_prop->doc_comment) {
+ zend_string_release_ex(coliding_prop->doc_comment, 0);
+ }
+ }
zend_hash_del(&ce->properties_info, prop_name);
flags |= ZEND_ACC_CHANGED;
} else {