Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel error: ob_end_flush(): failed to send buffer of zlib output compression (0)

Every time I have an error, for example: trying to access a property of a non-object, I get this message:

ob_end_flush(): failed to send buffer of zlib output compression (0)

open: /home/admin/domains/mysite/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php

$previous = null;
$obStatus = ob_get_status(1);
while (($level = ob_get_level()) > 0 && $level !== $previous) {
    $previous = $level;
    if ($obStatus[$level - 1]) {
        if (version_compare(PHP_VERSION, '5.4', '>=')) {
            if (isset($obStatus[$level - 1]['flags']) && ($obStatus[$level - 1]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE)) {
                ob_end_flush();
            }
        }
    }
}

I tried setting in php.ini:

zlib.output_compression = Off
zlib.output_handler =

but it does not help.

I am using Laravel 4.1

Does anyone know how to resolve this?

like image 397
Glad To Help Avatar asked Sep 07 '25 17:09

Glad To Help


2 Answers

If your are using @secction in your view then use @stop bellow the section to stop the section area

like image 191
Monojit Halder Avatar answered Sep 10 '25 07:09

Monojit Halder


Not sure if this helps, but I came across this question and thought I would share what fixed it for me, with the same error. It was caused by trying to set a null variable passed in via a section call. To fix it simply use a isset check.

@isset($var)
  @section('header', $var)
@endisset
like image 41
Brian Barthold Avatar answered Sep 10 '25 06:09

Brian Barthold