1--TEST-- 2Bug #25378 (unserialize() crashes with invalid data) 3--FILE-- 4<?php 5var_dump(unserialize("s:-1:\"\";")); 6var_dump(unserialize("i:823")); 7var_dump(unserialize("O:8:\"stdClass :0:{}")); 8var_dump(unserialize("O:8:\"stdClass\"+0:{}")); 9var_dump(unserialize("O:1000:\"stdClass\":0:{}")); 10var_dump(unserialize("a:2:{i:0;s:2:\"12\":")); 11var_dump(unserialize("a:2:{i:0;s:2:\"12\";i:1;s:3000:\"123")); 12var_dump(unserialize("a:2:{i:0;s:2:\"12\"+i:1;s:3:\"123\";}")); 13var_dump(unserialize("a:2:{i:0;s:2:\"12\";i:1;s:3:\"123\";")); 14var_dump(unserialize("s:3000:\"123\";")); 15var_dump(unserialize("s:3000:\"123")); 16var_dump(unserialize("s:3:\"123;")); 17var_dump(unserialize("s:0:\"123\";")); 18?> 19--EXPECTF-- 20Warning: unserialize(): Error at offset 0 of 8 bytes in %s on line %d 21bool(false) 22 23Warning: unserialize(): Error at offset 0 of 5 bytes in %s on line %d 24bool(false) 25 26Warning: unserialize(): Error at offset 13 of 19 bytes in %s on line %d 27bool(false) 28 29Warning: unserialize(): Error at offset 14 of 19 bytes in %s on line %d 30bool(false) 31 32Warning: unserialize(): Error at offset 2 of 22 bytes in %s on line %d 33bool(false) 34 35Warning: unserialize(): Error at offset 17 of 18 bytes in %s on line %d 36bool(false) 37 38Warning: unserialize(): Error at offset 24 of 33 bytes in %s on line %d 39bool(false) 40 41Warning: unserialize(): Error at offset 17 of 33 bytes in %s on line %d 42bool(false) 43 44Warning: unserialize(): Error at offset 32 of 32 bytes in %s on line %d 45bool(false) 46 47Warning: unserialize(): Error at offset 2 of 13 bytes in %s on line %d 48bool(false) 49 50Warning: unserialize(): Error at offset 2 of 11 bytes in %s on line %d 51bool(false) 52 53Warning: unserialize(): Error at offset 8 of 9 bytes in %s on line %d 54bool(false) 55 56Warning: unserialize(): Error at offset 5 of 10 bytes in %s on line %d 57bool(false) 58