1--TEST--
2Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - fatal error in write after 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    exit;
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): bool {
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();
44
45?>
46--EXPECTF--
47write: goodbye cruel world
48
49Fatal error: Uncaught Error: Call to undefined function undefined_function() in %s:%d
50Stack trace:
51#0 [internal function]: write(%s, '')
52#1 {main}
53  thrown in %s on line %d
54
55Warning: PHP Request Shutdown: Cannot call session save handler in a recursive manner in Unknown on line 0
56