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 11try { 12 unserialize($s, ["allowed_classes" => null]); 13} catch (TypeError $exception) { 14 echo $exception->getMessage() . "\n"; 15} 16 17try { 18 unserialize($s, ["allowed_classes" => 0]); 19} catch (TypeError $exception) { 20 echo $exception->getMessage() . "\n"; 21} 22 23 24try { 25 unserialize($s, ["allowed_classes" => 1]); 26} catch (TypeError $exception) { 27 echo $exception->getMessage() . "\n"; 28} 29 30?> 31--EXPECT-- 32unserialize(): Option "allowed_classes" must be of type array|bool, null given 33unserialize(): Option "allowed_classes" must be of type array|bool, int given 34unserialize(): Option "allowed_classes" must be of type array|bool, int given 35