Skip to content

Skip non-existing properties returned by __sleep() #5413

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions ext/standard/tests/serialize/bug14293.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ var_dump($t);
__sleep called

Notice: serialize(): "b" returned as member variable from __sleep() but does not exist in %sbug14293.php on line %d
O:1:"t":2:{s:1:"a";s:5:"hello";s:1:"b";N;}
object(t)#%d (2) {
O:1:"t":1:{s:1:"a";s:5:"hello";}
object(t)#%d (1) {
["a"]=>
string(5) "hello"
["b"]=>
NULL
}
12 changes: 4 additions & 8 deletions ext/standard/tests/serialize/bug69210.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,13 @@ var_dump(unserialize($ss));
var_dump(unserialize($si));
?>
--EXPECT--
O:10:"testString":2:{s:1:"a";b:1;s:1:"1";N;}
O:11:"testInteger":2:{s:1:"a";b:1;s:1:"1";N;}
object(testString)#3 (2) {
O:10:"testString":1:{s:1:"a";b:1;}
O:11:"testInteger":1:{s:1:"a";b:1;}
object(testString)#3 (1) {
["a"]=>
bool(true)
["1"]=>
NULL
}
object(testInteger)#3 (2) {
object(testInteger)#3 (1) {
["a"]=>
bool(true)
["1"]=>
NULL
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ Notice: serialize(): "pub" returned as member variable from __sleep() but does n
Notice: serialize(): "prot" returned as member variable from __sleep() but does not exist in %s on line %d

Notice: serialize(): "priv" returned as member variable from __sleep() but does not exist in %s on line %d
string(53) "O:4:"Test":3:{s:3:"pub";N;s:4:"prot";N;s:4:"priv";N;}"
string(15) "O:4:"Test":0:{}"
1 change: 0 additions & 1 deletion ext/standard/var.c
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,6 @@ static int php_var_serialize_get_sleep_props(

php_error_docref(NULL, E_NOTICE,
"\"%s\" returned as member variable from __sleep() but does not exist", ZSTR_VAL(name));
zend_hash_add(ht, name, &EG(uninitialized_zval));
zend_tmp_string_release(tmp_name);
} ZEND_HASH_FOREACH_END();

Expand Down
2 changes: 1 addition & 1 deletion tests/classes/bug26737.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ var_dump(str_replace("\0", '\0', $data));
?>
--EXPECTF--
Notice: serialize(): "no_such" returned as member variable from __sleep() but does not exist in %s on line %d
string(130) "O:3:"foo":4:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";s:7:"no_such";N;}"
string(114) "O:3:"foo":3:{s:12:"\0foo\0private";s:7:"private";s:12:"\0*\0protected";s:9:"protected";s:6:"public";s:6:"public";}"