1--TEST-- 2Test unserialize() with extra data at the end of a valid value 3--FILE-- 4<?php 5 6var_dump(unserialize('i:5;i:6;')); 7var_dump(unserialize('N;i:6;')); 8var_dump(unserialize('b:1;i:6;')); 9var_dump(unserialize('a:1:{s:3:"foo";b:1;}i:6;')); 10 11?> 12--EXPECTF-- 13Warning: unserialize(): Extra data starting at offset 4 of 8 bytes in %s on line %d 14int(5) 15 16Warning: unserialize(): Extra data starting at offset 2 of 6 bytes in %s on line %d 17NULL 18 19Warning: unserialize(): Extra data starting at offset 4 of 8 bytes in %s on line %d 20bool(true) 21 22Warning: unserialize(): Extra data starting at offset 20 of 24 bytes in %s on line %d 23array(1) { 24 ["foo"]=> 25 bool(true) 26} 27