1--TEST--
2Test session_set_save_handler() function : error functionality
3--SKIPIF--
4<?php include('skipif.inc'); ?>
5--FILE--
6<?php
7
8ob_start();
9
10echo "*** Testing session_set_save_handler() : error functionality ***\n";
11
12function callback() { return true; }
13
14try {
15    session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
16} catch (TypeError $exception) {
17    echo $exception->getMessage() . "\n";
18}
19
20try {
21    session_set_save_handler("callback", "echo", "callback", "callback", "callback", "callback");
22} catch (TypeError $exception) {
23    echo $exception->getMessage() . "\n";
24}
25
26try {
27    session_set_save_handler("callback", "callback", "echo", "callback", "callback", "callback");
28} catch (TypeError $exception) {
29    echo $exception->getMessage() . "\n";
30}
31
32try {
33    session_set_save_handler("callback", "callback", "callback", "echo", "callback", "callback");
34} catch (TypeError $exception) {
35    echo $exception->getMessage() . "\n";
36}
37
38try {
39    session_set_save_handler("callback", "callback", "callback", "callback", "echo", "callback");
40} catch (TypeError $exception) {
41    echo $exception->getMessage() . "\n";
42}
43
44try {
45    session_set_save_handler("callback", "callback", "callback", "callback", "callback", "echo");
46} catch (TypeError $exception) {
47    echo $exception->getMessage() . "\n";
48}
49
50session_set_save_handler("callback", "callback", "callback", "callback", "callback", "callback");
51
52var_dump(session_start());
53ob_end_flush();
54?>
55--EXPECTF--
56*** Testing session_set_save_handler() : error functionality ***
57session_set_save_handler(): Argument #2 ($close) must be a valid callback, function "echo" not found or invalid function name
58session_set_save_handler(): Argument #3 ($read) must be a valid callback, function "echo" not found or invalid function name
59session_set_save_handler(): Argument #4 ($write) must be a valid callback, function "echo" not found or invalid function name
60session_set_save_handler(): Argument #5 ($destroy) must be a valid callback, function "echo" not found or invalid function name
61session_set_save_handler(): Argument #6 ($gc) must be a valid callback, function "echo" not found or invalid function name
62
63Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
64bool(false)
65