php-src/ext/session/tests/bug60634_error_2.phpt
Sara Golemon 7c2489751c Followup fix to custom session save handlers
2d9885c introduced some regressions.  This addresses those.

  * Don't throw return type notice or session write failure when in an exception
  * Fix tests to properly return true/false since null is no longer falsy/successy
  * Rerecord a few tests to accomodate difference in raised warnings
2014-07-07 12:59:54 -07:00

54 lines
959 B
PHP

--TEST--
Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - exception in write during exec
--INI--
session.save_path=
session.name=PHPSESSID
--SKIPIF--
<?php include('skipif.inc'); ?>
--FILE--
<?php
ob_start();
function open($save_path, $session_name) {
return true;
}
function close() {
echo "close: goodbye cruel world\n";
return true;
}
function read($id) {
return '';
}
function write($id, $session_data) {
echo "write: goodbye cruel world\n";
throw new Exception;
}
function destroy($id) {
return true;
}
function gc($maxlifetime) {
return true;
}
session_set_save_handler('open', 'close', 'read', 'write', 'destroy', 'gc');
session_start();
session_write_close();
echo "um, hi\n";
?>
--EXPECTF--
write: goodbye cruel world
Fatal error: Uncaught exception 'Exception' in %s
Stack trace:
#0 [internal function]: write('%s', '')
#1 %s(%d): session_write_close()
#2 {main}
thrown in %s on line %d