@@ -668,6 +668,10 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int
668668 if (EXPECTED (Z_TYPE_P (retval ) != IS_UNDEF )) {
669669 goto exit ;
670670 }
671+ if (UNEXPECTED (Z_PROP_FLAG_P (retval ) == IS_PROP_UNINIT )) {
672+ /* Skip __get() for uninitialized typed properties */
673+ goto uninit_error ;
674+ }
671675 } else if (EXPECTED (IS_DYNAMIC_PROPERTY_OFFSET (property_offset ))) {
672676 if (EXPECTED (zobj -> properties != NULL )) {
673677 if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET (property_offset )) {
@@ -771,6 +775,7 @@ ZEND_API zval *zend_std_read_property(zend_object *zobj, zend_string *name, int
771775 }
772776 }
773777
778+ uninit_error :
774779 if (type != BP_VAR_IS ) {
775780 if (UNEXPECTED (prop_info )) {
776781 zend_throw_error (NULL , "Typed property %s::$%s must not be accessed before initialization" ,
@@ -1085,8 +1090,11 @@ ZEND_API void zend_std_unset_property(zend_object *zobj, zend_string *name, void
10851090 }
10861091 return ;
10871092 }
1088- /* Reset the IS_PROP_UNINIT flag, if it exists. */
1089- Z_PROP_FLAG_P (slot ) = 0 ;
1093+ if (UNEXPECTED (Z_PROP_FLAG_P (slot ) == IS_PROP_UNINIT )) {
1094+ /* Reset the IS_PROP_UNINIT flag, if it exists and bypass __unset(). */
1095+ Z_PROP_FLAG_P (slot ) = 0 ;
1096+ return ;
1097+ }
10901098 } else if (EXPECTED (IS_DYNAMIC_PROPERTY_OFFSET (property_offset ))
10911099 && EXPECTED (zobj -> properties != NULL )) {
10921100 if (UNEXPECTED (GC_REFCOUNT (zobj -> properties ) > 1 )) {
@@ -1674,6 +1682,11 @@ ZEND_API int zend_std_has_property(zend_object *zobj, zend_string *name, int has
16741682 if (Z_TYPE_P (value ) != IS_UNDEF ) {
16751683 goto found ;
16761684 }
1685+ if (UNEXPECTED (Z_PROP_FLAG_P (value ) == IS_PROP_UNINIT )) {
1686+ /* Skip __isset() for uninitialized typed properties */
1687+ result = 0 ;
1688+ goto exit ;
1689+ }
16771690 } else if (EXPECTED (IS_DYNAMIC_PROPERTY_OFFSET (property_offset ))) {
16781691 if (EXPECTED (zobj -> properties != NULL )) {
16791692 if (!IS_UNKNOWN_DYNAMIC_PROPERTY_OFFSET (property_offset )) {
0 commit comments