Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

White page when application using output buffers triggers notice/warning. #34

Open
Paso opened this issue Oct 17, 2012 · 3 comments
Open

Comments

@Paso
Copy link

Paso commented Oct 17, 2012

Cleaning output buffers (preferably in a loop as buffers can be nested) in ErrorHandler->discardBuffer() solves the problem.

The following code recreates the problem:

<?php

ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
error_reporting(-1);
require_once('../library/php_error.php');
\php_error\reportErrors();

ob_start();

echo "before";
trigger_error("ERROR", E_USER_NOTICE);
echo "after";

ob_flush();
@allixsenos
Copy link

adding

while(ob_end_clean());

at the beginning of discardBuffer() fixes it...

@websiteduck
Copy link

This will avoid an error if you're not currently in a buffer:

while (ob_get_level() > 0) ob_end_clean();

@kenorb
Copy link

kenorb commented Mar 24, 2016

Fixed in PR: #94

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants