@@ -784,9 +784,7 @@ static int php_var_serialize_try_add_sleep_prop(
784
784
if (Z_TYPE_P (val ) == IS_UNDEF ) {
785
785
zend_property_info * info = zend_get_typed_property_info_for_slot (Z_OBJ_P (struc ), val );
786
786
if (info ) {
787
- zend_throw_error (NULL ,
788
- "Typed property %s::$%s must not be accessed before initialization (in __sleep)" ,
789
- ZSTR_VAL (Z_OBJCE_P (struc )-> name ), ZSTR_VAL (error_name ));
787
+ return SUCCESS ;
790
788
}
791
789
return FAILURE ;
792
790
}
@@ -803,13 +801,12 @@ static int php_var_serialize_try_add_sleep_prop(
803
801
}
804
802
/* }}} */
805
803
806
- static int php_var_serialize_get_sleep_props (
804
+ static void php_var_serialize_get_sleep_props (
807
805
HashTable * ht , zval * struc , HashTable * sleep_retval ) /* {{{ */
808
806
{
809
807
zend_class_entry * ce = Z_OBJCE_P (struc );
810
808
HashTable * props = zend_get_properties_for (struc , ZEND_PROP_PURPOSE_SERIALIZE );
811
809
zval * name_val ;
812
- int retval = SUCCESS ;
813
810
814
811
zend_hash_init (ht , zend_hash_num_elements (sleep_retval ), NULL , ZVAL_PTR_DTOR , 0 );
815
812
/* TODO: Rewrite this by fetching the property info instead of trying out different
@@ -829,12 +826,6 @@ static int php_var_serialize_get_sleep_props(
829
826
continue ;
830
827
}
831
828
832
- if (EG (exception )) {
833
- zend_tmp_string_release (tmp_name );
834
- retval = FAILURE ;
835
- break ;
836
- }
837
-
838
829
priv_name = zend_mangle_property_name (
839
830
ZSTR_VAL (ce -> name ), ZSTR_LEN (ce -> name ),
840
831
ZSTR_VAL (name ), ZSTR_LEN (name ), ce -> type & ZEND_INTERNAL_CLASS );
@@ -845,12 +836,6 @@ static int php_var_serialize_get_sleep_props(
845
836
}
846
837
zend_string_release (priv_name );
847
838
848
- if (EG (exception )) {
849
- zend_tmp_string_release (tmp_name );
850
- retval = FAILURE ;
851
- break ;
852
- }
853
-
854
839
prot_name = zend_mangle_property_name (
855
840
"*" , 1 , ZSTR_VAL (name ), ZSTR_LEN (name ), ce -> type & ZEND_INTERNAL_CLASS );
856
841
if (php_var_serialize_try_add_sleep_prop (ht , props , prot_name , name , struc ) == SUCCESS ) {
@@ -860,20 +845,13 @@ static int php_var_serialize_get_sleep_props(
860
845
}
861
846
zend_string_release (prot_name );
862
847
863
- if (EG (exception )) {
864
- zend_tmp_string_release (tmp_name );
865
- retval = FAILURE ;
866
- break ;
867
- }
868
-
869
848
php_error_docref (NULL , E_NOTICE ,
870
849
"\"%s\" returned as member variable from __sleep() but does not exist" , ZSTR_VAL (name ));
871
850
zend_hash_add (ht , name , & EG (uninitialized_zval ));
872
851
zend_tmp_string_release (tmp_name );
873
852
} ZEND_HASH_FOREACH_END ();
874
853
875
854
zend_release_properties (props );
876
- return retval ;
877
855
}
878
856
/* }}} */
879
857
@@ -929,11 +907,10 @@ static void php_var_serialize_nested_data(smart_str *buf, zval *struc, HashTable
929
907
static void php_var_serialize_class (smart_str * buf , zval * struc , zval * retval_ptr , php_serialize_data_t var_hash ) /* {{{ */
930
908
{
931
909
HashTable props ;
932
- if (php_var_serialize_get_sleep_props (& props , struc , HASH_OF (retval_ptr )) == SUCCESS ) {
933
- php_var_serialize_class_name (buf , struc );
934
- php_var_serialize_nested_data (
935
- buf , struc , & props , zend_hash_num_elements (& props ), /* incomplete_class */ 0 , var_hash );
936
- }
910
+ php_var_serialize_get_sleep_props (& props , struc , HASH_OF (retval_ptr ));
911
+ php_var_serialize_class_name (buf , struc );
912
+ php_var_serialize_nested_data (
913
+ buf , struc , & props , zend_hash_num_elements (& props ), /* incomplete_class */ 0 , var_hash );
937
914
zend_hash_destroy (& props );
938
915
}
939
916
/* }}} */
0 commit comments