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: session_start(): Failed to initialize storage module: user (path: ) in %s on line 23 39 40Fatal error: Uncaught Exception: Do something bad..! in %s:13 41Stack trace: 42#0 [internal function]: open('', 'PHPSESSID') 43#1 %s(23): session_start() 44#2 {main} 45 thrown in %s on line 13 46