Error handler should only allow notices etc in smarty templates, not beyond
Only handle errors in the smarty compiled dir. Not errors that happen during smarty but somewhere else.
See #839
This has always been an important missing feature in Smarty error handler. rudiedirkx's solution looks good, I hope it gets merged into Smarty!
@wisskid Did you catch this somewhere else by now? I haven't been paying attention to Smarty merges. My method might not be acceptable, but Smarty has to check against $smarty->getCompileDir() probably.
@rudiedirkx I hadn't looked into this yet. Seems like a great improvement. At some point, I would like to get rid of the error handler altogether, but this seems like a great first step. I'll have to adapt it to the new v5 release, but this one will do just fine for v4. I'll merge it asap.
The base branch change did something weird to the diff. I resolved a merge conflict, but it's still weird. The error handler has changed in the meantime probably. All I did was add
if (strpos($errfile, $this->smarty->getCompileDir()) === 0) {
around all of the return conditions in handleError().
Smarty still needs its own error handler, doesn't it? You don't want an uncaught error to trace to a compiled Smarty template. Or maybe you do... I don't know. Twig catches all errors during a template and rethrows it with original template info. That's good for debugging.
I can't change the base branch of my fork, so I can't fix this.
@rudiedirkx how about uncompiled templates such as 'eval:' templates or stream plugins?
No idea. I've never used those. What are $errfile and $this->smarty->getCompileDir() then?
The compile dir is probably still the (default) compile dir, but $errfile will be the phone script calling the template. Which will not be in the compile dir.