File tree 3 files changed +15
-28
lines changed
3 files changed +15
-28
lines changed Original file line number Diff line number Diff line change 6
6
- Core:
7
7
. Fixed bug #78434 (Generator yields no items after valid() call). (Nikita)
8
8
. Fixed bug #79477 (casting object into array creates references). (Nikita)
9
+ . Fixed bug #79447 (Serializing uninitialized typed properties with __sleep should not throw). (nicolas-grekas)
9
10
10
11
- DOM:
11
12
. Fixed bug #78221 (DOMNode::normalize() doesn't remove empty text nodes).
Original file line number Diff line number Diff line change 1
1
--TEST--
2
- Referencing an uninitialized typed property in __sleep() should result in Error
2
+ Referencing an uninitialized typed property in __sleep() should be skipped
3
3
--FILE--
4
4
<?php
5
5
@@ -18,39 +18,27 @@ class Test {
18
18
}
19
19
20
20
$ t = new Test ;
21
- try {
22
- serialize ($ t );
23
- } catch (Error $ e ) {
24
- echo $ e ->getMessage (), "\n" ;
25
- }
21
+ var_dump (serialize ($ t ));
22
+ var_dump (unserialize (serialize ($ t )) == $ t );
26
23
27
24
$ t ->x = 1 ;
28
- try {
29
- serialize ($ t );
30
- } catch (Error $ e ) {
31
- echo $ e ->getMessage (), "\n" ;
32
- }
25
+ var_dump (unserialize (serialize ($ t )) == $ t );
33
26
34
27
$ t ->y = 2 ;
35
- try {
36
- serialize ($ t );
37
- } catch (Error $ e ) {
38
- echo $ e ->getMessage (), "\n" ;
39
- }
28
+ var_dump (unserialize (serialize ($ t )) == $ t );
40
29
41
30
$ t ->z = 3 ;
42
- try {
43
- var_dump (unserialize (serialize ($ t )));
44
- } catch (Error $ e ) {
45
- echo $ e ->getMessage (), "\n" ;
46
- }
31
+ var_dump (unserialize (serialize ($ t )) == $ t );
47
32
33
+ var_dump ($ t );
48
34
?>
49
35
--EXPECT--
50
- Typed property Test::$x must not be accessed before initialization (in __sleep)
51
- Typed property Test::$y must not be accessed before initialization (in __sleep)
52
- Typed property Test::$z must not be accessed before initialization (in __sleep)
53
- object(Test)#3 (3) {
36
+ string(15) "O:4:"Test":0:{}"
37
+ bool(true)
38
+ bool(true)
39
+ bool(true)
40
+ bool(true)
41
+ object(Test)#1 (3) {
54
42
["x"]=>
55
43
int(1)
56
44
["y":protected]=>
Original file line number Diff line number Diff line change @@ -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
}
You can’t perform that action at this time.
0 commit comments