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":2:{s:1:"a";b:1;s:1:"1";N;} 39O:11:"testInteger":2:{s:1:"a";b:1;s:1:"1";N;} 40object(testString)#3 (2) { 41 ["a"]=> 42 bool(true) 43 ["1"]=> 44 NULL 45} 46object(testInteger)#3 (2) { 47 ["a"]=> 48 bool(true) 49 ["1"]=> 50 NULL 51}