Annotation of embedaddon/php/ext/session/tests/session_set_save_handler_variation4.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test session_set_save_handler() function : variation
! 3: --SKIPIF--
! 4: <?php include('skipif.inc'); ?>
! 5: --INI--
! 6: session.gc_probability=1
! 7: session.gc_divisor=1
! 8: session.gc_maxlifetime=0
! 9: session.save_path=
! 10: session.name=PHPSESSID
! 11: --FILE--
! 12: <?php
! 13:
! 14: ob_start();
! 15:
! 16: /*
! 17: * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
! 18: * Description : Sets user-level session storage functions
! 19: * Source code : ext/session/session.c
! 20: */
! 21:
! 22: echo "*** Testing session_set_save_handler() : variation ***\n";
! 23:
! 24: function noisy_gc($maxlifetime) {
! 25: echo("GC [".$maxlifetime."]\n");
! 26: gc($maxlifetime);
! 27: }
! 28:
! 29: require_once "save_handler.inc";
! 30: $path = dirname(__FILE__);
! 31: session_save_path($path);
! 32: session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc");
! 33:
! 34: session_start();
! 35: $_SESSION["Blah"] = "Hello World!";
! 36: $_SESSION["Foo"] = FALSE;
! 37: $_SESSION["Guff"] = 1234567890;
! 38: var_dump($_SESSION);
! 39: $session_id = session_id();
! 40: var_dump(session_write_close());
! 41:
! 42: session_set_save_handler("open", "close", "read", "write", "destroy", "noisy_gc");
! 43: session_id($session_id);
! 44: session_start();
! 45: var_dump($_SESSION);
! 46: var_dump(session_destroy());
! 47:
! 48: ob_end_flush();
! 49: ?>
! 50: --EXPECTF--
! 51: *** Testing session_set_save_handler() : variation ***
! 52:
! 53: Open [%s,PHPSESSID]
! 54: Read [%s,%s]
! 55: GC [0]
! 56: array(3) {
! 57: ["Blah"]=>
! 58: string(12) "Hello World!"
! 59: ["Foo"]=>
! 60: bool(false)
! 61: ["Guff"]=>
! 62: int(1234567890)
! 63: }
! 64: Write [%s,%s,Blah|s:12:"Hello World!";Foo|b:0;Guff|i:1234567890;]
! 65: Close [%s,PHPSESSID]
! 66: NULL
! 67: Open [%s,PHPSESSID]
! 68: Read [%s,%s]
! 69: GC [0]
! 70: array(3) {
! 71: ["Blah"]=>
! 72: string(12) "Hello World!"
! 73: ["Foo"]=>
! 74: bool(false)
! 75: ["Guff"]=>
! 76: int(1234567890)
! 77: }
! 78: Destroy [%s,%s]
! 79:
! 80: Warning: unlink(%s): No such file or directory in %s on line %d
! 81: Close [%s,PHPSESSID]
! 82: bool(true)
! 83:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>