1--TEST--
2Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - fatal error in write during exec
3--INI--
4session.save_path=
5session.name=PHPSESSID
6session.save_handler=files
7--EXTENSIONS--
8session
9--SKIPIF--
10<?php include('skipif.inc'); ?>
11--FILE--
12<?php
13
14ob_start();
15
16function open($save_path, $session_name) {
17    return true;
18}
19
20function close() {
21    echo "close: goodbye cruel world\n";
22    return true;
23}
24
25function read($id) {
26    return '';
27}
28
29function write($id, $session_data) {
30    echo "write: goodbye cruel world\n";
31    undefined_function();
32}
33
34function destroy($id) {
35    return true;
36}
37
38function gc($maxlifetime) {
39    return true;
40}
41
42session_set_save_handler('open', 'close', 'read', 'write', 'destroy', 'gc');
43session_start();
44session_write_close();
45echo "um, hi\n";
46
47/*
48FIXME: Something wrong. It should try to close after error, otherwise session
49may keep "open" state.
50*/
51
52?>
53--EXPECTF--
54write: goodbye cruel world
55
56Fatal error: Uncaught Error: Call to undefined function undefined_function() in %s:%d
57Stack trace:
58#0 [internal function]: write(%s, '')
59#1 %s(%d): session_write_close()
60#2 {main}
61  thrown in %s on line %d
62