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
PHP notice raises ExceptionError? #187
Comments
I'm going to update initial informations. Which, at his point of my comprehension, makes the situation even more complicated. I have a pug file with - $bar = new Foo()
= $bar->get_key('non-existent-key') Given that class Foo {
$ary = array('foo' => 'baz')
function get_key($key){
return this->$ary[$key]
}
} It seems to me that since W/o any more information this sounds as a bug to me. Looking for more. Thanks in advance |
Hi, my proposition is to provide some settings to set error_reporting into account or a custom settings for errors: But you must understand that if we do not catch errors, we will not be able to tell where it happened in the pug code. That's why the Renderer use a sandbox to catch errors, then add infos about the matching position in the pug code and re-throw or display it. The error handler is not a bug, we will keep it because for 99% of cases, the wrapped error is more useful than the original error. Moreover, the wrapped error contains the original error, so no information can be lost. But I agree to provide settings to ignore notice errors, strict standard errors and so on. |
Hi @kylekatarnls , I'm absolutely with you about the usefulness of the error handler. But :)
I'm writing a template for WordPress and using a I and a colleague of mine thought about using a Summarizing: We've migrated from pug-php v2 to v3 and we think it's an awesome work, and the debug/error handling implementations are just great. But I can't be responsible for notices from vendor (or just another dev team from my company) libraries while building a template. The interface I'd expect would be an Moreover: could we think about do honor the PHP error reporting settings? A lot of thoughts, in the hope they could be somewhat useful. Thanks for your support |
Yes You can already try the new sandbox with - error_reporting(E_ALL ^E_NOTICE)
= $array['non-existent-key'] Obviously, you can set I will add an option soon to customize the error handling inside templates. |
Hi, here is the new option you can change by using the new renderer ( I close this issue but do not hesitate to answer on it if you get any trouble. |
I'm really sorry to come back just now. ATM here just to thank you for this improvement. I'm going to work on it. |
Hello,
I encountered an issue with the following code:
= $array['non-existent-key']
I expected to get:
But I actually get an ExceptionError.
Undefined index AFAIK will generate a notice in PHP. Why is Phug throwing an ExceptionError? Is this expected behaviour? Is this a configurable behaviour?
Thanks!
The text was updated successfully, but these errors were encountered: