Annotation of embedaddon/php/ext/session/tests/session_set_save_handler_error3.phpt, revision 1.1
1.1 ! misho 1: --TEST--
! 2: Test session_set_save_handler() function : error functionality
! 3: --INI--
! 4: session.save_path=
! 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(callback $open, callback $close, callback $read, callback $write, callback $destroy, callback $gc)
! 15: * Description : Sets user-level session storage functions
! 16: * Source code : ext/session/session.c
! 17: */
! 18:
! 19: echo "*** Testing session_set_save_handler() : error functionality ***\n";
! 20: function open($save_path, $session_name) {
! 21: throw new Exception("Do something bad..!");
! 22: }
! 23:
! 24: function close() { return true; }
! 25: function read($id) { return false; }
! 26: function write($id, $session_data) { }
! 27: function destroy($id) { return true; }
! 28: function gc($maxlifetime) { return true; }
! 29:
! 30: session_set_save_handler("open", "close", "read", "write", "destroy", "gc");
! 31: session_start();
! 32: ob_end_flush();
! 33: ?>
! 34: --EXPECTF--
! 35: *** Testing session_set_save_handler() : error functionality ***
! 36:
! 37: Fatal error: Uncaught exception 'Exception' with message 'Do something bad..!' in %s:%d
! 38: Stack trace:
! 39: #0 [internal function]: open('', 'PHPSESSID')
! 40: #1 %s(%d): session_start()
! 41: #2 {main}
! 42: thrown in %s on line %d
! 43:
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>