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