File tree Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Expand file tree Collapse file tree 3 files changed +34
-4
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ PHP NEWS
2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? ????, PHP 7.3.13
4
4
5
+ - Core:
6
+ . Fixed bug #78787 (Segfault with trait overriding inherited private shadow
7
+ property). (Nikita)
8
+
5
9
21 Nov 2019, PHP 7.3.12
6
10
7
11
- Core:
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #78787: Segfault with trait overriding inherited private shadow property
3
+ --FILE--
4
+ <?php
5
+
6
+ trait T {
7
+ private $ prop ;
8
+ }
9
+ class C1 {
10
+ /** Doc comment */
11
+ private $ prop ;
12
+ }
13
+ class C2 extends C1 {
14
+ }
15
+ class C3 extends C2 {
16
+ use T;
17
+ }
18
+
19
+ ?>
20
+ ===DONE===
21
+ --EXPECT--
22
+ ===DONE===
Original file line number Diff line number Diff line change @@ -1595,10 +1595,14 @@ static void zend_do_traits_property_binding(zend_class_entry *ce) /* {{{ */
1595
1595
/* next: check for conflicts with current class */
1596
1596
if ((coliding_prop = zend_hash_find_ptr (& ce -> properties_info , prop_name )) != NULL ) {
1597
1597
if (coliding_prop -> flags & ZEND_ACC_SHADOW ) {
1598
- zend_string_release_ex (coliding_prop -> name , 0 );
1599
- if (coliding_prop -> doc_comment ) {
1600
- zend_string_release_ex (coliding_prop -> doc_comment , 0 );
1601
- }
1598
+ /* Only free if shadow is coming from direct parent,
1599
+ * otherwise these weren't copied in the first place. */
1600
+ if (coliding_prop -> ce == ce -> parent ) {
1601
+ zend_string_release_ex (coliding_prop -> name , 0 );
1602
+ if (coliding_prop -> doc_comment ) {
1603
+ zend_string_release_ex (coliding_prop -> doc_comment , 0 );
1604
+ }
1605
+ }
1602
1606
zend_hash_del (& ce -> properties_info , prop_name );
1603
1607
flags |= ZEND_ACC_CHANGED ;
1604
1608
} else {
You can’t perform that action at this time.
0 commit comments