File tree Expand file tree Collapse file tree 3 files changed +33
-15
lines changed Expand file tree Collapse file tree 3 files changed +33
-15
lines changed Original file line number Diff line number Diff line change @@ -3414,23 +3414,16 @@ static void preload_link(void)
3414
3414
}
3415
3415
} ZEND_HASH_FOREACH_END ();
3416
3416
if (ce -> default_properties_count ) {
3417
- zend_class_entry * pce = ce ;
3418
-
3419
- val = ce -> default_properties_table + ce -> default_properties_count - 1 ;
3420
- do {
3421
- uint32_t count = pce -> parent ? pce -> default_properties_count - pce -> parent -> default_properties_count : pce -> default_properties_count ;
3422
-
3423
- while (count ) {
3424
- if (Z_TYPE_P (val ) == IS_CONSTANT_AST ) {
3425
- if (UNEXPECTED (zval_update_constant_ex (val , pce ) != SUCCESS )) {
3426
- ok = 0 ;
3427
- }
3417
+ uint32_t i ;
3418
+ for (i = 0 ; i < ce -> default_properties_count ; i ++ ) {
3419
+ val = & ce -> default_properties_table [i ];
3420
+ if (Z_TYPE_P (val ) == IS_CONSTANT_AST ) {
3421
+ zend_property_info * prop = ce -> properties_info_table [i ];
3422
+ if (UNEXPECTED (zval_update_constant_ex (val , prop -> ce ) != SUCCESS )) {
3423
+ ok = 0 ;
3428
3424
}
3429
- val -- ;
3430
- count -- ;
3431
3425
}
3432
- pce = pce -> parent ;
3433
- } while (pce && pce -> default_properties_count );
3426
+ }
3434
3427
}
3435
3428
if (ce -> default_static_members_count ) {
3436
3429
uint32_t count = ce -> parent ? ce -> default_static_members_count - ce -> parent -> default_static_members_count : ce -> default_static_members_count ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Initializer of overwritten property should be resolved against the correct class
3
+ --INI--
4
+ opcache.enable=1
5
+ opcache.enable_cli=1
6
+ opcache.optimization_level=-1
7
+ opcache.preload={PWD}/preload_overwritten_prop_init.inc
8
+ --SKIPIF--
9
+ <?php require_once ('skipif.inc ' ); ?>
10
+ --FILE--
11
+ <?php
12
+ var_dump ((new Bar )->prop );
13
+ ?>
14
+ --EXPECT--
15
+ int(42)
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ class Foo {
4
+ public $ prop ;
5
+ }
6
+
7
+ class Bar extends Foo {
8
+ public $ prop = self ::FOOBAR ;
9
+ const FOOBAR = 42 ;
10
+ }
You can’t perform that action at this time.
0 commit comments