1
0
mirror of https://github.com/php/php-src.git synced 2026-03-28 02:02:32 +01:00
Files
archived-php-src/ext/standard/tests/strings/bug72663.phpt
Nikita Popov 0c450967e1 Simplify two unserialize() tests
unserialize() returns false for these now, so it doesn't make sense
to try and do something with the result.
2019-07-10 11:09:54 +02:00

29 lines
792 B
PHP

--TEST--
Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deserialization
--FILE--
<?php
class obj implements Serializable {
var $data;
function serialize() {
return serialize($this->data);
}
function unserialize($data) {
$this->data = unserialize($data);
}
}
$inner = 'a:1:{i:0;O:9:"Exception":2:{s:7:"'."\0".'*'."\0".'file";R:4;}';
$exploit = 'a:2:{i:0;C:3:"obj":'.strlen($inner).':{'.$inner.'}i:1;R:4;}';
var_dump(unserialize($exploit));
?>
DONE
--EXPECTF--
Notice: unserialize(): Unexpected end of serialized data in %sbug72663.php on line %d
Notice: unserialize(): Error at offset 46 of 47 bytes in %sbug72663.php on line %d
Notice: unserialize(): Error at offset 79 of 80 bytes in %sbug72663.php on line %d
bool(false)
DONE