Skip to content

ob handler should not print the output in case of callback exception #8866

@mvorisek

Description

@mvorisek

Description

The following code:

<?php

ob_start(function ($buffer) {
    // return '';
    throw new \Exception('x');
});

echo 5;

try {
    ob_flush();
} catch (\Exception $e) {
    echo $e;
}

Expected output:

-5Exception: x in /in/kQMfY:5
+Exception: x in /in/kQMfY:5
 Stack trace:
 #0 [internal function]: {closure}('5', 5)
 #1 /in/kQMfY(11): ob_flush()
 #2 {main}

https://3v4l.org/kQMfY

PHP Version

any

Operating System

any

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions