mirror of
https://github.com/php/php-src.git
synced 2026-03-24 00:02:20 +01:00
When an `PHP_OUTPUT_HANDLER_FAILURE` occurs, the output handler becomes disabled (i.e. the `PHP_OUTPUT_HANDLER_DISABLED` flag is set). However, there is no guard for disabled handlers in `php_output_handler_op()` what may cause serious issues (as reported, UB due to passing `NULL` as the 2nd argument of `memcpy`, because the handler's buffer has already been `NULL`ed). Therefore, we add a respective guard for disabled handlers, and return `PHP_OUTPUT_HANDLER_FAILURE` right away. Closes GH-15183.
16 lines
237 B
PHP
16 lines
237 B
PHP
--TEST--
|
|
Fix GH-15181 (Disabled output handler is flushed again)
|
|
--FILE--
|
|
<?php
|
|
ob_start(function () {
|
|
throw new Exception('ob_start');
|
|
});
|
|
try {
|
|
ob_flush();
|
|
} catch (Throwable) {}
|
|
ob_flush();
|
|
?>
|
|
===DONE===
|
|
--EXPECT--
|
|
===DONE===
|