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

a method to dynamically loosen error reporting #44

Open
allixsenos opened this issue Nov 18, 2012 · 2 comments
Open

a method to dynamically loosen error reporting #44

allixsenos opened this issue Nov 18, 2012 · 2 comments

Comments

@allixsenos
Copy link

a modern framework might have two realms of PHP code - actual code and templates, and in templates the codestyle might be more forgiving of stuff like undefined array indices, etc

it would be nice to have an API call to loosen the error reporting a bit once the code hits the stage where it's done all the heavy lifting and all it has to do is render the HTML

it can currently be achieved by just disabling the error handler, but it would be nice to still get the nice error page if a more serious error is done in templates (undefined function, etc) while letting through stuff like undefined var/array element

@MZAWeb
Copy link

MZAWeb commented Nov 22, 2012

I think allowing this is not a good move. Developers should be aware of what they do, and do it right. But I can totally see the point of not having a black window blocking all for an index notice, for instance. Maybe a small error report at the top of the page and then render the site?

@allixsenos
Copy link
Author

I've worked around it with

require_once 'data/includes/php_error.php';
$errorhandler = \php_error\reportErrors(array('error_reporting_on' => E_ALL | E_STRICT));

and then later down

if (!empty($errorhandler)) {
    $errorhandler->turnOff();
    $errorhandler = \php_error\reportErrors(array('error_reporting_on' => (E_ALL | E_STRICT) & ~E_NOTICE));
}

something like $errorhandler->change_error_reporting(...) would be nice

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

2 participants