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