1--TEST-- 2Test session_set_save_handler() : shutdown failure 3--INI-- 4session.save_handler=files 5session.name=PHPSESSID 6--SKIPIF-- 7<?php include('skipif.inc'); ?> 8--FILE-- 9<?php 10 11ob_start(); 12 13echo "*** Testing session_set_save_handler() : shutdown failure ***\n"; 14 15class MySession extends SessionHandler { 16 public $num; 17 public $destroyed = false; 18 public function __construct($num) { 19 $this->num = $num; 20 echo "(#$this->num) constructor called\n"; 21 } 22 public function __destruct() { 23 echo "(#$this->num) destructor called\n"; 24 $this->destroyed = true; 25 } 26 public function write($id, $data) { 27 if ($this->destroyed) { 28 echo "(#$this->num) destroyed, cannot write\n"; 29 } else { 30 echo "(#$this->num) writing $id = $data\n"; 31 } 32 return parent::write($id, $data); 33 } 34 public function close() { 35 $id = session_id(); 36 if ($this->destroyed) { 37 echo "(#$this->num) destroyed, cannot write\n"; 38 } else { 39 echo "(#$this->num) closing $id\n"; 40 } 41 return parent::close(); 42 } 43} 44 45$handler = new MySession(1); 46session_set_save_handler($handler, false); 47session_start(); 48 49$_SESSION['foo'] = 'bar'; 50 51echo "done\n"; 52ob_end_flush(); 53?> 54--EXPECT-- 55*** Testing session_set_save_handler() : shutdown failure *** 56(#1) constructor called 57done 58(#1) destructor called 59(#1) destroyed, cannot write 60(#1) destroyed, cannot write 61