1--TEST--
2Bug #60634 (Segmentation fault when trying to die() in SessionHandler::write()) - exception in write during exec
3--INI--
4session.save_path=
5session.name=PHPSESSID
6session.save_handler=files
7--EXTENSIONS--
8session
9--FILE--
10<?php
11
12ob_start();
13
14class MySessionHandler implements SessionHandlerInterface {
15    function open($save_path, $session_name): bool {
16        return true;
17    }
18
19    function close(): bool {
20        echo "close: goodbye cruel world\n";
21        return true;
22    }
23
24    function read($id): string|false {
25        return '';
26    }
27
28    function write($id, $session_data): bool {
29        echo "write: goodbye cruel world\n";
30        throw new Exception;
31    }
32
33    function destroy($id): bool {
34        return true;
35    }
36
37    function gc($maxlifetime): int {
38        return true;
39    }
40}
41
42session_set_save_handler(new MySessionHandler());
43session_start();
44session_write_close();
45echo "um, hi\n";
46
47?>
48--EXPECTF--
49write: goodbye cruel world
50
51Fatal error: Uncaught Exception in %s
52Stack trace:
53#0 [internal function]: MySessionHandler->write('%s', '')
54#1 %s(%d): session_write_close()
55#2 {main}
56  thrown in %s on line %d
57