mirror of
https://github.com/php/php-src.git
synced 2024-12-01 13:54:10 +08:00
dd5538566e
when user defined __sleep() is declared. Additionally E_NOTICE is being thrown if __sleep() returns a non-existing member variable name
23 lines
696 B
PHP
23 lines
696 B
PHP
--TEST--
|
|
Bug #26737 (Protected and private variables are not saved on serialization when a user defined __sleep is used)
|
|
--FILE--
|
|
<?php
|
|
class foo
|
|
{
|
|
private $private = 'private';
|
|
protected $protected = 'protected';
|
|
public $public = 'public';
|
|
|
|
public function __sleep()
|
|
{
|
|
return array('private', 'protected', 'public', 'no_such');
|
|
}
|
|
}
|
|
$foo = new foo();
|
|
$data = serialize($foo);
|
|
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;}"
|