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