1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Files
archived-php-src/ext/standard/tests/strings/bug72663_2.phpt
T
Christoph M. Becker 08858e7cca Fix #73529: session_decode() silently fails on wrong input
The `php_serialize` decode function has to return `FAILURE`, if the
unserialization failed on anything but an empty string.

The `php` decode function has also to return `FAILURE`, if there is
trailing garbage in the string.
2020-06-10 16:48:49 +02:00

26 lines
598 B
PHP

--TEST--
Bug #72663: Create an Unexpected Object and Don't Invoke __wakeup() in Deserialization
--SKIPIF--
<?php
if (!extension_loaded("session")) {
die("skip");
}
?>
--FILE--
<?php
ini_set('session.serialize_handler', 'php_serialize');
session_start();
$sess = 'O:9:"Exception":2:{s:7:"'."\0".'*'."\0".'file";R:1;}';
session_decode($sess);
var_dump($_SESSION);
?>
DONE
--EXPECTF--
Notice: session_decode(): Unexpected end of serialized data in %sbug72663_2.php on line %d
Warning: session_decode(): Failed to decode session object. Session has been destroyed in %s on line %d
array(0) {
}
DONE