1--TEST-- 2Test unserialize() with non-bool/array allowed_classes 3--FILE-- 4<?php 5class foo { 6 public $x = "bar"; 7} 8$z = array(new foo(), 2, "3"); 9$s = serialize($z); 10 11var_dump(unserialize($s, ["allowed_classes" => null])); 12var_dump(unserialize($s, ["allowed_classes" => 0])); 13var_dump(unserialize($s, ["allowed_classes" => 1])); 14 15--EXPECTF-- 16array(3) { 17 [0]=> 18 object(__PHP_Incomplete_Class)#%d (2) { 19 ["__PHP_Incomplete_Class_Name"]=> 20 string(3) "foo" 21 ["x"]=> 22 string(3) "bar" 23 } 24 [1]=> 25 int(2) 26 [2]=> 27 string(1) "3" 28} 29array(3) { 30 [0]=> 31 object(__PHP_Incomplete_Class)#%d (2) { 32 ["__PHP_Incomplete_Class_Name"]=> 33 string(3) "foo" 34 ["x"]=> 35 string(3) "bar" 36 } 37 [1]=> 38 int(2) 39 [2]=> 40 string(1) "3" 41} 42array(3) { 43 [0]=> 44 object(foo)#%d (1) { 45 ["x"]=> 46 string(3) "bar" 47 } 48 [1]=> 49 int(2) 50 [2]=> 51 string(1) "3" 52} 53