1--TEST--
2Test session_set_save_handler() : incorrect arguments for existing handler open
3--INI--
4session.save_handler=files
5session.name=PHPSESSID
6session.gc_probability=0
7--SKIPIF--
8<?php include('skipif.inc'); ?>
9--FILE--
10<?php
11
12ob_start();
13
14/*
15 * Prototype : bool session_set_save_handler(SessionHandler $handler [, bool $register_shutdown_function = true])
16 * Description : Sets user-level session storage functions
17 * Source code : ext/session/session.c
18 */
19
20echo "*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***\n";
21
22class MySession extends SessionHandler {
23	public $i = 0;
24	public function open($path, $name) {
25		++$this->i;
26		echo 'Open ', session_id(), "\n";
27		return parent::open();
28	}
29	public function read($key) {
30		++$this->i;
31		echo 'Read ', session_id(), "\n";
32		return parent::read($key);
33	}
34}
35
36$oldHandler = ini_get('session.save_handler');
37$handler = new MySession;
38session_set_save_handler($handler);
39session_start();
40
41var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
42
43--EXPECTF--
44*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
45Open
46
47Warning: SessionHandler::open() expects exactly 2 parameters, 0 given in %s on line %d
48Read %s
49
50Warning: SessionHandler::read(): Parent session handler is not open in %s on line %d
51string(%d) "%s"
52string(5) "files"
53string(4) "user"
54int(2)
55array(0) {
56}
57
58Warning: Unknown: Parent session handler is not open in Unknown on line 0
59
60Warning: Unknown: Parent session handler is not open in Unknown on line 0
61