1--TEST-- 2serialize() integrity with non string on __sleep 3--FILE-- 4<?php 5class testString 6{ 7 public $a = true; 8 9 public function __sleep() 10 { 11 return array('a', '1'); 12 } 13} 14 15class testInteger 16{ 17 public $a = true; 18 19 public function __sleep() 20 { 21 return array('a', 1); 22 } 23} 24 25$cs = new testString(); 26$ci = new testInteger(); 27 28$ss = @serialize($cs); 29echo $ss . "\n"; 30 31$si = @serialize($ci); 32echo $si . "\n"; 33 34var_dump(unserialize($ss)); 35var_dump(unserialize($si)); 36?> 37--EXPECT-- 38O:10:"testString":1:{s:1:"a";b:1;} 39O:11:"testInteger":1:{s:1:"a";b:1;} 40object(testString)#3 (1) { 41 ["a"]=> 42 bool(true) 43} 44object(testInteger)#3 (1) { 45 ["a"]=> 46 bool(true) 47} 48