xref: /PHP-7.4/ext/session/tests/bug73529.phpt (revision 35b3c864)
1--TEST--
2Bug #73529 session_decode() silently fails on wrong input
3--XFAIL--
4session_decode() does not return proper status.
5--SKIPIF--
6<?php include('skipif.inc'); ?>
7--FILE--
8<?php
9
10ini_set("session.serialize_handler", "php_serialize");
11session_start();
12
13$result1 = session_decode(serialize(["foo" => "bar"]));
14$session1 = $_SESSION;
15session_destroy();
16
17ini_set("session.serialize_handler", "php");
18session_start();
19
20$result2 = session_decode(serialize(["foo" => "bar"]));
21$session2 = $_SESSION;
22session_destroy();
23
24var_dump($result1);
25var_dump($session1);
26var_dump($result2);
27var_dump($session2);
28
29?>
30--EXPECT--
31bool(true)
32array(1) {
33  ["foo"]=>
34  string(3) "bar"
35}
36bool(false)
37array(0) {
38}
39