File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / session / tests / session_set_save_handler_class_006.phpt
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Tue May 29 12:34:42 2012 UTC (12 years, 1 month 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, HEAD
php 5.4.3+patches

    1: --TEST--
    2: Test session_set_save_handler() : using objects in close
    3: --INI--
    4: session.save_handler=files
    5: session.name=PHPSESSID
    6: --SKIPIF--
    7: <?php include('skipif.inc'); ?>
    8: --FILE--
    9: <?php
   10: 
   11: ob_start();
   12: 
   13: /* 
   14:  * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
   15:  * Description : Sets user-level session storage functions
   16:  * Source code : ext/session/session.c 
   17:  */
   18: 
   19: echo "*** Testing session_set_save_handler() : using objects in close ***\n";
   20: 
   21: class MySession7_Foo {
   22: 	public $state = 'ok';
   23: 	function __destruct() {
   24: 		$this->state = 'destroyed';
   25: 	}
   26: }
   27: 
   28: class MySession7 extends SessionHandler {
   29: 	public $foo;
   30: 	public function close() {
   31: 		var_dump($this->foo);
   32: 		@var_dump($GLOBALS['bar']);
   33: 		return parent::close();
   34: 	}
   35: }
   36: 
   37: $bar = new MySession7_Foo;
   38: $handler = new MySession7;
   39: $handler->foo = new MySession7_Foo;
   40: session_set_save_handler($handler);
   41: session_start();
   42: 
   43: ob_end_flush();
   44: ?>
   45: --EXPECTF--
   46: *** Testing session_set_save_handler() : using objects in close ***
   47: object(MySession7_Foo)#%d (%d) {
   48:   ["state"]=>
   49:   string(2) "ok"
   50: }
   51: object(MySession7_Foo)#%d (%d) {
   52:   ["state"]=>
   53:   string(2) "ok"
   54: }

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