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, 3 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, HEAD
php 5.4.3+patches

--TEST--
Test session_set_save_handler() : using objects in close
--INI--
session.save_handler=files
session.name=PHPSESSID
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php

ob_start();

/* 
 * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
 * Description : Sets user-level session storage functions
 * Source code : ext/session/session.c 
 */

echo "*** Testing session_set_save_handler() : using objects in close ***\n";

class MySession7_Foo {
	public $state = 'ok';
	function __destruct() {
		$this->state = 'destroyed';
	}
}

class MySession7 extends SessionHandler {
	public $foo;
	public function close() {
		var_dump($this->foo);
		@var_dump($GLOBALS['bar']);
		return parent::close();
	}
}

$bar = new MySession7_Foo;
$handler = new MySession7;
$handler->foo = new MySession7_Foo;
session_set_save_handler($handler);
session_start();

ob_end_flush();
?>
--EXPECTF--
*** Testing session_set_save_handler() : using objects in close ***
object(MySession7_Foo)#%d (%d) {
  ["state"]=>
  string(2) "ok"
}
object(MySession7_Foo)#%d (%d) {
  ["state"]=>
  string(2) "ok"
}

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