@@ -3532,7 +3532,8 @@ static zend_never_inline void zend_assign_to_property_reference_var_var(zval *co
3532
3532
OPLINE_CC EXECUTE_DATA_CC );
3533
3533
}
3534
3534
3535
- static zend_never_inline zend_result zend_fetch_static_property_address_ex (zval * * retval , zend_property_info * * prop_info , uint32_t cache_slot , int fetch_type OPLINE_DC EXECUTE_DATA_DC ) {
3535
+ static zend_never_inline zval * zend_fetch_static_property_address_ex (zend_property_info * * prop_info , uint32_t cache_slot , int fetch_type OPLINE_DC EXECUTE_DATA_DC ) {
3536
+ zval * result ;
3536
3537
zend_string * name ;
3537
3538
zend_class_entry * ce ;
3538
3539
zend_property_info * property_info ;
@@ -3548,7 +3549,7 @@ static zend_never_inline zend_result zend_fetch_static_property_address_ex(zval
3548
3549
ce = zend_fetch_class_by_name (Z_STR_P (class_name ), Z_STR_P (class_name + 1 ), ZEND_FETCH_CLASS_DEFAULT | ZEND_FETCH_CLASS_EXCEPTION );
3549
3550
if (UNEXPECTED (ce == NULL )) {
3550
3551
FREE_OP (op1_type , opline -> op1 .var );
3551
- return FAILURE ;
3552
+ return NULL ;
3552
3553
}
3553
3554
if (UNEXPECTED (op1_type != IS_CONST )) {
3554
3555
CACHE_PTR (cache_slot , ce );
@@ -3559,21 +3560,21 @@ static zend_never_inline zend_result zend_fetch_static_property_address_ex(zval
3559
3560
ce = zend_fetch_class (NULL , opline -> op2 .num );
3560
3561
if (UNEXPECTED (ce == NULL )) {
3561
3562
FREE_OP (op1_type , opline -> op1 .var );
3562
- return FAILURE ;
3563
+ return NULL ;
3563
3564
}
3564
3565
} else {
3565
3566
ce = Z_CE_P (EX_VAR (opline -> op2 .var ));
3566
3567
}
3567
3568
if (EXPECTED (op1_type == IS_CONST ) && EXPECTED (CACHED_PTR (cache_slot ) == ce )) {
3568
- * retval = CACHED_PTR (cache_slot + sizeof (void * ));
3569
+ result = CACHED_PTR (cache_slot + sizeof (void * ));
3569
3570
* prop_info = CACHED_PTR (cache_slot + sizeof (void * ) * 2 );
3570
- return SUCCESS ;
3571
+ return result ;
3571
3572
}
3572
3573
}
3573
3574
3574
3575
if (EXPECTED (op1_type == IS_CONST )) {
3575
3576
name = Z_STR_P (RT_CONSTANT (opline , opline -> op1 ));
3576
- * retval = zend_std_get_static_property_with_info (ce , name , fetch_type , & property_info );
3577
+ result = zend_std_get_static_property_with_info (ce , name , fetch_type , & property_info );
3577
3578
} else {
3578
3579
zend_string * tmp_name ;
3579
3580
zval * varname = get_zval_ptr_undef (opline -> op1_type , opline -> op1 , BP_VAR_R );
@@ -3586,62 +3587,109 @@ static zend_never_inline zend_result zend_fetch_static_property_address_ex(zval
3586
3587
}
3587
3588
name = zval_get_tmp_string (varname , & tmp_name );
3588
3589
}
3589
- * retval = zend_std_get_static_property_with_info (ce , name , fetch_type , & property_info );
3590
+ result = zend_std_get_static_property_with_info (ce , name , fetch_type , & property_info );
3590
3591
3591
3592
zend_tmp_string_release (tmp_name );
3592
3593
3593
3594
FREE_OP (op1_type , opline -> op1 .var );
3594
3595
}
3595
3596
3596
- if (UNEXPECTED (* retval == NULL )) {
3597
- return FAILURE ;
3597
+ if (UNEXPECTED (result == NULL )) {
3598
+ return NULL ;
3598
3599
}
3599
3600
3600
3601
* prop_info = property_info ;
3601
3602
3602
3603
if (EXPECTED (op1_type == IS_CONST )
3603
3604
&& EXPECTED (!(property_info -> ce -> ce_flags & ZEND_ACC_TRAIT ))) {
3604
- CACHE_POLYMORPHIC_PTR (cache_slot , ce , * retval );
3605
+ CACHE_POLYMORPHIC_PTR (cache_slot , ce , result );
3605
3606
CACHE_PTR (cache_slot + sizeof (void * ) * 2 , property_info );
3606
3607
}
3607
3608
3608
- return SUCCESS ;
3609
+ return result ;
3609
3610
}
3610
3611
3611
3612
3612
- static zend_always_inline zend_result zend_fetch_static_property_address (zval * * retval , zend_property_info * * prop_info , uint32_t cache_slot , int fetch_type , int flags OPLINE_DC EXECUTE_DATA_DC ) {
3613
+ static zend_always_inline zval * zend_fetch_static_property_address (zend_property_info * * prop_info , uint32_t cache_slot , int fetch_type , int flags OPLINE_DC EXECUTE_DATA_DC ) {
3614
+ zval * result ;
3613
3615
zend_property_info * property_info ;
3614
3616
3615
- if (opline -> op1_type == IS_CONST && (opline -> op2_type == IS_CONST || (opline -> op2_type == IS_UNUSED && (opline -> op2 .num == ZEND_FETCH_CLASS_SELF || opline -> op2 .num == ZEND_FETCH_CLASS_PARENT ))) && EXPECTED (CACHED_PTR (cache_slot ) != NULL )) {
3616
- * retval = CACHED_PTR (cache_slot + sizeof (void * ));
3617
+ if (opline -> op1_type == IS_CONST
3618
+ && (opline -> op2_type == IS_CONST
3619
+ || (opline -> op2_type == IS_UNUSED
3620
+ && (opline -> op2 .num == ZEND_FETCH_CLASS_SELF
3621
+ || opline -> op2 .num == ZEND_FETCH_CLASS_PARENT )))
3622
+ && EXPECTED (CACHED_PTR (cache_slot + sizeof (void * )) != NULL )) {
3623
+ result = CACHED_PTR (cache_slot + sizeof (void * ));
3617
3624
property_info = CACHED_PTR (cache_slot + sizeof (void * ) * 2 );
3618
3625
3619
3626
if ((fetch_type == BP_VAR_R || fetch_type == BP_VAR_RW )
3620
- && UNEXPECTED (Z_TYPE_P (* retval ) == IS_UNDEF )
3627
+ && UNEXPECTED (Z_TYPE_P (result ) == IS_UNDEF )
3621
3628
&& ZEND_TYPE_IS_SET (property_info -> type )) {
3622
3629
zend_throw_error (NULL , "Typed static property %s::$%s must not be accessed before initialization" ,
3623
3630
ZSTR_VAL (property_info -> ce -> name ),
3624
3631
zend_get_unmangled_property_name (property_info -> name ));
3625
- return FAILURE ;
3632
+ return NULL ;
3626
3633
}
3627
3634
} else {
3628
- zend_result success ;
3629
- success = zend_fetch_static_property_address_ex (retval , & property_info , cache_slot , fetch_type OPLINE_CC EXECUTE_DATA_CC );
3630
- if (UNEXPECTED (success != SUCCESS )) {
3631
- return FAILURE ;
3635
+ result = zend_fetch_static_property_address_ex (& property_info , cache_slot , fetch_type OPLINE_CC EXECUTE_DATA_CC );
3636
+ if (UNEXPECTED (!result )) {
3637
+ return NULL ;
3632
3638
}
3633
3639
}
3634
3640
3635
3641
flags &= ZEND_FETCH_OBJ_FLAGS ;
3636
3642
if (flags && ZEND_TYPE_IS_SET (property_info -> type )) {
3637
- zend_handle_fetch_obj_flags (NULL , * retval , NULL , property_info , flags );
3643
+ zend_handle_fetch_obj_flags (NULL , result , NULL , property_info , flags );
3638
3644
}
3639
3645
3640
3646
if (prop_info ) {
3641
3647
* prop_info = property_info ;
3642
3648
}
3643
3649
3644
- return SUCCESS ;
3650
+ return result ;
3651
+ }
3652
+
3653
+ ZEND_API zval * ZEND_FASTCALL zend_fetch_static_property (zend_execute_data * ex , int fetch_type ) {
3654
+ zval * result ;
3655
+ zend_property_info * property_info ;
3656
+ #if defined(ZEND_VM_FP_GLOBAL_REG ) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL ) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID ))
3657
+ zend_execute_data * orig_execute_data = execute_data ;
3658
+ #else
3659
+ zend_execute_data * execute_data ;
3660
+ #endif
3661
+ execute_data = ex ;
3662
+ #if defined(ZEND_VM_IP_GLOBAL_REG ) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL ) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID ))
3663
+ const zend_op * orig_opline = opline ;
3664
+ #else
3665
+ const zend_op * opline ;
3666
+ #endif
3667
+ opline = execute_data -> opline ;
3668
+
3669
+ uint32_t cache_slot = opline -> extended_value & ~ZEND_FETCH_OBJ_FLAGS ;
3670
+ uint32_t flags = 0 ;
3671
+
3672
+ if (fetch_type == BP_VAR_W ) {
3673
+ flags = opline -> extended_value & ZEND_FETCH_OBJ_FLAGS ;
3674
+ }
3675
+ result = zend_fetch_static_property_address_ex (& property_info , cache_slot , fetch_type OPLINE_CC EXECUTE_DATA_CC );
3676
+ if (EXPECTED (result )) {
3677
+ if (flags && ZEND_TYPE_IS_SET (property_info -> type )) {
3678
+ zend_handle_fetch_obj_flags (NULL , result , NULL , property_info , flags );
3679
+ }
3680
+ } else {
3681
+ result = & EG (uninitialized_zval );
3682
+ }
3683
+
3684
+ #if defined(ZEND_VM_IP_GLOBAL_REG ) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL ) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID ))
3685
+ EX (opline ) = opline ;
3686
+ opline = orig_opline ;
3687
+ #endif
3688
+ #if defined(ZEND_VM_FP_GLOBAL_REG ) && ((ZEND_VM_KIND == ZEND_VM_KIND_CALL ) || (ZEND_VM_KIND == ZEND_VM_KIND_HYBRID ))
3689
+ execute_data = orig_execute_data ;
3690
+ #endif
3691
+
3692
+ return result ;
3645
3693
}
3646
3694
3647
3695
ZEND_API ZEND_COLD void zend_throw_ref_type_error_type (const zend_property_info * prop1 , const zend_property_info * prop2 , const zval * zv ) {
0 commit comments