File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / ext / session / tests / session_set_save_handler_class_005.phpt
Revision 1.1.1.2 (vendor branch): download - view: text, annotated - select for diffs - revision graph
Sun Jun 15 20:03:55 2014 UTC (10 years, 1 month ago) by misho
Branches: php, MAIN
CVS tags: v5_4_29, HEAD
php 5.4.29

    1: --TEST--
    2: Test session_set_save_handler() : incomplete implementation
    3: --INI--
    4: session.save_handler=files
    5: session.name=PHPSESSID
    6: session.gc_probability=0
    7: --SKIPIF--
    8: <?php include('skipif.inc'); ?>
    9: --FILE--
   10: <?php
   11: 
   12: ob_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: 
   20: echo "*** Testing session_set_save_handler() : incomplete implementation ***\n";
   21: 
   22: class MySession6 extends SessionHandler {
   23: 	public function open($path, $name) {
   24: 		// don't call parent
   25: 		return true;
   26: 	}
   27: 
   28: 	public function read($id) {
   29: 		// should error because parent::open hasn't been called
   30: 		return parent::read($id);
   31: 	}
   32: }
   33: 
   34: $handler = new MySession6;
   35: session_set_save_handler($handler);
   36: session_start();
   37: 
   38: var_dump(session_id(), ini_get('session.save_handler'), $_SESSION);
   39: 
   40: session_write_close();
   41: session_unset();
   42: 
   43: 
   44: --EXPECTF--
   45: *** Testing session_set_save_handler() : incomplete implementation ***
   46: 
   47: Warning: SessionHandler::read(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
   48: string(%d) "%s"
   49: string(4) "user"
   50: array(0) {
   51: }
   52: 
   53: Warning: SessionHandler::write(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d
   54: 
   55: Warning: SessionHandler::close(): Parent session handler is not open in %ssession_set_save_handler_class_005.php on line %d

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>