@@ -1405,12 +1405,24 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
14051405 UNEXPECTED ((* zend_get_property_guard (zobj , name )) & IN_GET ) ||
14061406 UNEXPECTED (prop_info && (Z_PROP_FLAG_P (retval ) & IS_PROP_UNINIT ))) {
14071407 if (UNEXPECTED (zend_lazy_object_must_init (zobj ) && (Z_PROP_FLAG_P (retval ) & IS_PROP_LAZY ))) {
1408- zobj = zend_lazy_object_init (zobj );
1409- if (!zobj ) {
1408+ bool guarded = zobj -> ce -> __get
1409+ && (* zend_get_property_guard (zobj , name ) & IN_GET );
1410+ zend_object * instance = zend_lazy_object_init (zobj );
1411+ if (!instance ) {
14101412 return & EG (error_zval );
14111413 }
14121414
1413- return zend_std_get_property_ptr_ptr (zobj , name , type , cache_slot );
1415+ if (guarded && (instance -> ce -> ce_flags & ZEND_ACC_USE_GUARDS )) {
1416+ uint32_t * guard = zend_get_property_guard (instance , name );
1417+ if (!(* guard & IN_GET )) {
1418+ (* guard ) |= IN_GET ;
1419+ retval = zend_std_get_property_ptr_ptr (instance , name , type , cache_slot );
1420+ (* guard ) &= ~IN_GET ;
1421+ return retval ;
1422+ }
1423+ }
1424+
1425+ return zend_std_get_property_ptr_ptr (instance , name , type , cache_slot );
14141426 }
14151427 if (UNEXPECTED (type == BP_VAR_RW || type == BP_VAR_R )) {
14161428 if (prop_info ) {
@@ -1453,6 +1465,25 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
14531465 }
14541466 if (EXPECTED (!zobj -> ce -> __get ) ||
14551467 UNEXPECTED ((* zend_get_property_guard (zobj , name )) & IN_GET )) {
1468+ if (UNEXPECTED (zend_lazy_object_must_init (zobj ))) {
1469+ bool guarded = (zobj -> ce -> __get != NULL );
1470+ zend_object * instance = zend_lazy_object_init (zobj );
1471+ if (!instance ) {
1472+ return & EG (error_zval );
1473+ }
1474+
1475+ if (guarded && (instance -> ce -> ce_flags & ZEND_ACC_USE_GUARDS )) {
1476+ uint32_t * guard = zend_get_property_guard (instance , name );
1477+ if (!(* guard & IN_GET )) {
1478+ (* guard ) |= IN_GET ;
1479+ retval = zend_std_get_property_ptr_ptr (instance , name , type , cache_slot );
1480+ (* guard ) &= ~IN_GET ;
1481+ return retval ;
1482+ }
1483+ }
1484+
1485+ return zend_std_get_property_ptr_ptr (instance , name , type , cache_slot );
1486+ }
14561487 if (UNEXPECTED (zobj -> ce -> ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES )) {
14571488 zend_forbidden_dynamic_property (zobj -> ce , name );
14581489 return & EG (error_zval );
@@ -1462,14 +1493,6 @@ ZEND_API zval *zend_std_get_property_ptr_ptr(zend_object *zobj, zend_string *nam
14621493 return & EG (error_zval );
14631494 }
14641495 }
1465- if (UNEXPECTED (zend_lazy_object_must_init (zobj ))) {
1466- zobj = zend_lazy_object_init (zobj );
1467- if (!zobj ) {
1468- return & EG (error_zval );
1469- }
1470-
1471- return zend_std_get_property_ptr_ptr (zobj , name , type , cache_slot );
1472- }
14731496 if (UNEXPECTED (!zobj -> properties )) {
14741497 rebuild_object_properties_internal (zobj );
14751498 }
0 commit comments