1--TEST--
2Test session_set_save_handler() : using objects in close
3--INI--
4session.save_handler=files
5session.name=PHPSESSID
6--SKIPIF--
7<?php include('skipif.inc'); ?>
8--FILE--
9<?php
10
11ob_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
19echo "*** Testing session_set_save_handler() : using objects in close ***\n";
20
21class MySession7_Foo {
22	public $state = 'ok';
23	function __destruct() {
24		$this->state = 'destroyed';
25	}
26}
27
28class 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;
40session_set_save_handler($handler);
41session_start();
42
43ob_end_flush();
44?>
45--EXPECTF--
46*** Testing session_set_save_handler() : using objects in close ***
47object(MySession7_Foo)#%d (%d) {
48  ["state"]=>
49  string(2) "ok"
50}
51object(MySession7_Foo)#%d (%d) {
52  ["state"]=>
53  string(2) "ok"
54}
55