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