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		// This test was written for broken return value handling
28		// Mimmick what was actually being tested by returning true here
29		return (null === parent::open());
30	}
31	public function read($key) {
32		++$this->i;
33		echo 'Read ', session_id(), "\n";
34		return parent::read($key);
35	}
36}
37
38$oldHandler = ini_get('session.save_handler');
39$handler = new MySession;
40session_set_save_handler($handler);
41var_dump(session_start());
42
43var_dump(session_id(), $oldHandler, ini_get('session.save_handler'), $handler->i, $_SESSION);
44--EXPECTF--
45*** Testing session_set_save_handler() : incorrect arguments for existing handler open ***
46Open
47
48Warning: SessionHandler::open() expects exactly 2 parameters, 0 given in %s on line %d
49Read %s
50
51Warning: SessionHandler::read(): Parent session handler is not open in %s on line %d
52
53Warning: SessionHandler::close(): Parent session handler is not open in %s on line %d
54
55Warning: session_start(): Failed to read session data: user (%s) in %s on line %d
56bool(false)
57string(0) ""
58string(5) "files"
59string(4) "user"
60int(2)
61array(0) {
62}
63