1--TEST-- 2Bug #14293 (serialize() and __sleep()) 3--FILE-- 4<?php 5class t 6{ 7 function __construct() 8 { 9 $this->a = 'hello'; 10 } 11 12 function __sleep() 13 { 14 echo "__sleep called\n"; 15 return array('a','b'); 16 } 17} 18 19$t = new t(); 20$data = serialize($t); 21echo "$data\n"; 22$t = unserialize($data); 23var_dump($t); 24 25?> 26--EXPECTF-- 27__sleep called 28 29Notice: serialize(): "b" returned as member variable from __sleep() but does not exist in %sbug14293.php on line %d 30O:1:"t":2:{s:1:"a";s:5:"hello";s:1:"b";N;} 31object(t)#%d (2) { 32 ["a"]=> 33 string(5) "hello" 34 ["b"]=> 35 NULL 36} 37