Stop output buffer cleanup at buffers that cannot be removed

zlib.output_compression makes its buffer non-removable once it has sent
compressed output, so ob_end_clean() raised a notice that replaced the
original exception. Fixes #704.
This commit is contained in:
dualfroz committed 2026-10-02 16:11:20 +02:00
1 parent a5b89f86ae
commit 13ce578de8
4 files changed
+73 -2

No files matched your search

+19
View File
@@ -68,6 +68,20 @@ class SystemFacadeTest extends TestCase
$this->facade->endOutputBuffering();
}
public function test_it_reports_a_removable_output_buffer()
{
self::$runtime->shouldReceive('ob_get_status')->once()->andReturn(['flags' => PHP_OUTPUT_HANDLER_STDFLAGS]);
$this->assertTrue($this->facade->isOutputBufferRemovable());
}
public function test_it_reports_a_non_removable_output_buffer()
{
self::$runtime->shouldReceive('ob_get_status')->once()->andReturn(['flags' => PHP_OUTPUT_HANDLER_STDFLAGS & ~PHP_OUTPUT_HANDLER_REMOVABLE]);
$this->assertFalse($this->facade->isOutputBufferRemovable());
}
public function test_it_delegates_flushing_the_current_buffer_to_the_native_implementation()
{
self::$runtime->shouldReceive('flush')->once();
@@ -161,6 +175,11 @@ function ob_end_clean()
return SystemFacadeTest::delegate('ob_end_clean');
}
function ob_get_status()
{
return SystemFacadeTest::delegate('ob_get_status');
}
function flush()
{
return SystemFacadeTest::delegate('flush');