xref: /PHP-8.2/tests/output/bug70970.phpt (revision f8d79582)
1--TEST--
2Bug #70970 (Segfault when combining error handler with output buffering)
3--FILE--
4<?php
5function exception_error_handler($severity, $message, $file, $line)
6{
7    throw new Exception($message, 0);
8}
9
10set_error_handler('exception_error_handler');
11
12function obHandler($buffer, $phase = null)
13{
14    try {
15        ob_start();
16    } catch (Exception $e) {
17        return (string) $e;
18    }
19
20    return $buffer;
21}
22
23ob_start('obHandler');
24
25print 'test';
26?>
27--EXPECTF--
28Fatal error: ob_start(): Cannot use output buffering in output buffering display handlers in %sbug70970.php on line %d
29