1--TEST--
2Test session_set_save_handler() function : error functionality
3--INI--
4session.save_path=
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(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
15 * Description : Sets user-level session storage functions
16 * Source code : ext/session/session.c
17 */
18
19echo "*** Testing session_set_save_handler() : error functionality ***\n";
20function open($save_path, $session_name) {
21     throw new Exception("Do something bad..!");
22}
23
24function close() { return true; }
25function read($id) { return false; }
26function write($id, $session_data) { }
27function destroy($id) {  return true; }
28function gc($maxlifetime) {  return true; }
29
30session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
31session_start();
32ob_end_flush();
33?>
34--EXPECTF--
35*** Testing session_set_save_handler() : error functionality ***
36
37Fatal error: Uncaught exception 'Exception' with message 'Do something bad..!' in %s:%d
38Stack trace:
39#0 [internal function]: open('', 'PHPSESSID')
40#1 %s(%d): session_start()
41#2 {main}
42  thrown in %s on line %d
43