File tree Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Expand file tree Collapse file tree 3 files changed +45
-2
lines changed Original file line number Diff line number Diff line change 5
5
- Core:
6
6
. Fixed GH-19169 build issue with C++17 and ZEND_STATIC_ASSERT macro.
7
7
(psumbera)
8
+ . Fixed bug GH-19053 (Duplicate property slot with hooks and interface
9
+ property). (ilutov)
8
10
9
11
- Hash:
10
12
. Fix crash on clone failure. (nielsdos)
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-19053: Incorrect properties_info_table for abstract properties
3
+ --FILE--
4
+ <?php
5
+
6
+ abstract class GP {
7
+ public abstract mixed $ foo { get; }
8
+ }
9
+
10
+ class P extends GP {
11
+ public mixed $ foo = 1 ;
12
+ }
13
+
14
+ class C extends P {
15
+ public mixed $ foo { get => 2 ; }
16
+ }
17
+
18
+ $ c = new C ;
19
+ var_dump ($ c );
20
+
21
+ ?>
22
+ --EXPECTF--
23
+ object(C)#%d (0) {
24
+ ["foo"]=>
25
+ uninitialized(mixed)
26
+ }
Original file line number Diff line number Diff line change @@ -1687,10 +1687,25 @@ void zend_build_properties_info_table(zend_class_entry *ce)
1687
1687
}
1688
1688
}
1689
1689
1690
- ZEND_HASH_MAP_FOREACH_PTR (& ce -> properties_info , prop ) {
1690
+ ZEND_HASH_MAP_FOREACH_STR_KEY_PTR (& ce -> properties_info , zend_string * key , prop ) {
1691
1691
if (prop -> ce == ce && (prop -> flags & ZEND_ACC_STATIC ) == 0
1692
1692
&& !(prop -> flags & ZEND_ACC_VIRTUAL )) {
1693
- uint32_t prop_table_offset = OBJ_PROP_TO_NUM (!(prop -> prototype -> flags & ZEND_ACC_VIRTUAL ) ? prop -> prototype -> offset : prop -> offset );
1693
+ const zend_property_info * root_prop = prop -> prototype ;
1694
+ if (UNEXPECTED (root_prop -> flags & ZEND_ACC_VIRTUAL )) {
1695
+ /* Prototype is virtual, we need to manually hunt down the first backed property. */
1696
+ root_prop = prop ;
1697
+ zend_class_entry * parent_ce ;
1698
+ while ((parent_ce = root_prop -> ce -> parent )) {
1699
+ zend_property_info * parent_prop = zend_hash_find_ptr (& parent_ce -> properties_info , key );
1700
+ if (!parent_prop
1701
+ || parent_prop -> prototype != prop -> prototype
1702
+ || (parent_prop -> flags & ZEND_ACC_VIRTUAL )) {
1703
+ break ;
1704
+ }
1705
+ root_prop = parent_prop ;
1706
+ }
1707
+ }
1708
+ uint32_t prop_table_offset = OBJ_PROP_TO_NUM (root_prop -> offset );
1694
1709
table [prop_table_offset ] = prop ;
1695
1710
}
1696
1711
} ZEND_HASH_FOREACH_END ();
You can’t perform that action at this time.
0 commit comments