1--TEST-- 2Test session_set_save_handler() function : error functionality 3--INI-- 4session.save_path= 5session.name=PHPSESSID 6session.save_handler=files 7--SKIPIF-- 8<?php include('skipif.inc'); ?> 9--FILE-- 10<?php 11 12ob_start(); 13 14/* 15 * Prototype : bool session_set_save_handler(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc) 16 * Description : Sets user-level session storage functions 17 * Source code : ext/session/session.c 18 */ 19 20echo "*** Testing session_set_save_handler() : error functionality ***\n"; 21function open($save_path, $session_name) { 22 throw new Exception("Do something bad..!"); 23} 24 25function close() { return true; } 26function read($id) { return false; } 27function write($id, $session_data) { } 28function destroy($id) { return true; } 29function gc($maxlifetime) { return true; } 30 31session_set_save_handler("open", "close", "read", "write", "destroy", "gc"); 32session_start(); 33ob_end_flush(); 34?> 35--EXPECTF-- 36*** Testing session_set_save_handler() : error functionality *** 37 38Warning: Uncaught Exception: Do something bad..! in %s:%d 39Stack trace: 40#0 [internal function]: open('', 'PHPSESSID') 41#1 %s(%d): session_start() 42#2 {main} 43 thrown in %s on line %d 44 45Fatal error: session_start(): Failed to initialize storage module: %s in %ssession_set_save_handler_error3.php on line %d 46