File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / session / tests / session_decode_variation3.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:48:01 2012 UTC (12 years, 5 months ago) by misho
Branches: php, MAIN
CVS tags: v5_4_3elwix, v5_4_29p0, v5_4_29, v5_4_20p0, v5_4_20, v5_4_17p0, v5_4_17, v5_3_10, HEAD
php

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

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>