1--TEST-- 2Test session_set_save_handler() : incorrect arguments for existing handler 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() : incorrect arguments for existing handler close ***\n"; 20 21class MySession extends SessionHandler { 22 public $i = 0; 23 public function open($path, $name) { 24 ++$this->i; 25 echo 'Open ', session_id(), "\n"; 26 return parent::open($path, $name); 27 } 28 public function read($key) { 29 ++$this->i; 30 echo 'Read ', session_id(), "\n"; 31 return parent::read($key); 32 } 33 public function close() { 34 return parent::close(false); 35 } 36} 37 38$oldHandler = ini_get('session.save_handler'); 39$handler = new MySession; 40session_set_save_handler($handler); 41session_start(); 42 43var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION); 44 45--EXPECTF-- 46*** Testing session_set_save_handler() : incorrect arguments for existing handler close *** 47Open 48Read %s 49string(%d) "%s" 50string(5) "files" 51string(4) "user" 52int(2) 53array(0) { 54} 55 56Warning: SessionHandler::close() expects exactly 0 parameters, 1 given in %s on line %d 57