Bug #78565 [NEW]: Shutdown functions are not called when exit is called from output handler

From: Date: Thu, 19 Sep 2019 07:41:42 +0000
Subject: Bug #78565 [NEW]: Shutdown functions are not called when exit is called from output handler
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222824@lists.php.net to get a copy of this message
From:             video dot ice dot power at seznam dot cz
Operating system: Debian 9
PHP version:      7.3.9
Package:          *General Issues
Bug Type:         Bug
Bug description:Shutdown functions are not called when exit is called from output handler

Description:
------------
Shutdown functions are not called when exit is called from output
handler

Test script:
---------------
<?php

// capture any unexpected output and exit execution
ob_start(function($buffer) {
    echo 'unexpected output: ' . $buffer . "\n";
    exit;
}, 1);

// do some work on shutdown
register_shutdown_function(function() {
    ob_flush();
    ob_end_clean();
    echo 'shutting down';
});

echo 'x';

Expected result:
----------------
unexpected output: x
shutting down

Actual result:
--------------
(empty result)

-- 
Edit bug report at https://bugs.php.net/bug.php?id=78565&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=78565&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=78565&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=78565&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=78565&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=78565&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=78565&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=78565&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=78565&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=78565&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=78565&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78565&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=78565&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=78565&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=78565&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=78565&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=78565&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=78565&r=mysqlcfg


Thread (7 messages)

« previous php.bugs (#222824) next »