@@ -629,6 +629,16 @@ ZEND_API uint32_t *zend_get_property_guard(zend_object *zobj, zend_string *membe
629
629
}
630
630
/* }}} */
631
631
632
+ static zend_always_inline zend_property_info * prop_info_for_offset (
633
+ zend_object * obj , uint32_t prop_offset , void * * cache_slot ) {
634
+ if (cache_slot ) {
635
+ return cache_slot [2 ];
636
+ } else {
637
+ zend_property_info * info = zend_get_property_info_for_slot (obj , OBJ_PROP (obj , prop_offset ));
638
+ return (info && info -> type ) ? info : NULL ;
639
+ }
640
+ }
641
+
632
642
ZEND_API zval * zend_std_read_property (zval * object , zval * member , int type , void * * cache_slot , zval * rv ) /* {{{ */
633
643
{
634
644
zend_object * zobj ;
@@ -743,7 +753,8 @@ ZEND_API zval *zend_std_read_property(zval *object, zval *member, int type, void
743
753
744
754
if (UNEXPECTED (ZEND_CLASS_HAS_TYPE_HINTS (zobj -> ce ) &&
745
755
IS_VALID_PROPERTY_OFFSET (property_offset ) &&
746
- (prop_info = zend_object_fetch_property_type_info (Z_OBJCE_P (object ), name , cache_slot )))) {
756
+ (prop_info = prop_info_for_offset (Z_OBJ_P (object ), property_offset , cache_slot )))
757
+ ) {
747
758
zend_verify_prop_assignable_by_ref (prop_info , retval , (zobj -> ce -> __get -> common .fn_flags & ZEND_ACC_STRICT_TYPES ) != 0 );
748
759
}
749
760
@@ -760,7 +771,7 @@ ZEND_API zval *zend_std_read_property(zval *object, zval *member, int type, void
760
771
761
772
if (type != BP_VAR_IS ) {
762
773
if (IS_VALID_PROPERTY_OFFSET (property_offset ) &&
763
- (prop_info = zend_object_fetch_property_type_info ( Z_OBJCE_P (object ), name , cache_slot ))) {
774
+ (prop_info = prop_info_for_offset ( Z_OBJ_P (object ), property_offset , cache_slot ))) {
764
775
zend_throw_error (NULL , "Typed property %s::$%s must not be accessed before initialization" ,
765
776
ZSTR_VAL (prop_info -> ce -> name ),
766
777
ZSTR_VAL (name ));
@@ -793,7 +804,7 @@ ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value,
793
804
if (EXPECTED (IS_VALID_PROPERTY_OFFSET (property_offset ))) {
794
805
variable_ptr = OBJ_PROP (zobj , property_offset );
795
806
if (Z_TYPE_P (variable_ptr ) != IS_UNDEF ) {
796
- zend_property_info * prop_info = zend_object_fetch_property_type_info ( Z_OBJCE_P (object ), name , cache_slot );
807
+ zend_property_info * prop_info = prop_info_for_offset ( Z_OBJ_P (object ), property_offset , cache_slot );
797
808
798
809
Z_TRY_ADDREF_P (value );
799
810
@@ -858,7 +869,7 @@ ZEND_API zval *zend_std_write_property(zval *object, zval *member, zval *value,
858
869
859
870
variable_ptr = OBJ_PROP (zobj , property_offset );
860
871
861
- if (UNEXPECTED (prop_info = zend_object_fetch_property_type_info ( Z_OBJCE_P (object ), name , cache_slot ))) {
872
+ if (UNEXPECTED (prop_info = prop_info_for_offset ( Z_OBJ_P (object ), property_offset , cache_slot ))) {
862
873
ZVAL_COPY_VALUE (& tmp , value );
863
874
if (UNEXPECTED (!zend_verify_property_type (prop_info , & tmp , ZEND_CALL_USES_STRICT_TYPES (EG (current_execute_data ))))) {
864
875
zval_ptr_dtor (value );
0 commit comments