1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64
|
--TEST--
Test session_decode() function : variation
--SKIPIF--
<?php include('skipif.inc'); ?>
--INI--
session.serialize_handler=blah
--FILE--
<?php
ob_start();
/*
* Prototype : string session_decode(void)
* Description : Decodes session data from a string
* Source code : ext/session/session.c
*/
echo "*** Testing session_decode() : variation ***\n";
var_dump(session_start());
var_dump($_SESSION);
$_SESSION["foo"] = 1234567890;
$_SESSION["bar"] = "Blah!";
$_SESSION["guff"] = 123.456;
var_dump($_SESSION);
$encoded = "foo|i:1234567890;";
var_dump(session_decode($encoded));
var_dump($_SESSION);
var_dump(session_destroy());
echo "Done";
ob_end_flush();
?>
--EXPECTF--
*** Testing session_decode() : variation ***
Warning: session_start(): Cannot find serialization handler 'blah' - session startup failed in %s on line %d
bool(false)
Notice: Undefined variable: _SESSION in %s on line %d
NULL
array(3) {
["foo"]=>
int(1234567890)
["bar"]=>
string(5) "Blah!"
["guff"]=>
float(123.456)
}
Warning: session_decode(): Unknown session.serialize_handler. Failed to decode session object in %s on line %d
bool(false)
array(3) {
["foo"]=>
int(1234567890)
["bar"]=>
string(5) "Blah!"
["guff"]=>
float(123.456)
}
Warning: session_destroy(): Trying to destroy uninitialized session in %s on line %d
bool(false)
Done
|