xref: /PHP-5.4/tests/classes/bug26737.phpt (revision dd553856)
1--TEST--
2Bug #26737 (Protected and private variables are not saved on serialization when a user defined __sleep is used)
3--FILE--
4<?php
5class foo
6{
7	private $private = 'private';
8	protected $protected = 'protected';
9	public $public = 'public';
10
11	public function __sleep()
12	{
13		return array('private', 'protected', 'public', 'no_such');
14	}
15}
16$foo = new foo();
17$data = serialize($foo);
18var_dump(str_replace("\0", '\0', $data));
19?>
20--EXPECTF--
21Notice: serialize(): "no_such" returned as member variable from __sleep() but does not exist in %s on line %d
22string(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;}"
23