mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-14 03:16:34 +00:00
cfb341f4baf152c710a7e5b885230495125168c3
This PR was merged into the master branch. Commits -------db13b66Pass lineno and filename to Twig_Error constructorfeee667Merge branch 'nativeext-exception-info' of https://github.com/fabpot/Twig into nativeext-exception-infoadb31d4Call Twig_Error constructord4a8c8badded tests for exceptions thrown in Twig_Template::getAttribute()1b82bf7Add template filename for the rest of the exception5675140Handle NULL filename71f64bcAdd template name to error message Discussion ---------- Add template name to error message Issue #884 --------------------------------------------------------------------------- by fabpot at 2012-11-06T07:43:16Z For some unknown reasons, I don't see your branch when I try to submit a PR. Can you cherry-pick my unit tests from my `nativeext-exception-info` branch? --------------------------------------------------------------------------- by Tobion at 2012-11-06T08:29:19Z @char101 Maybe you could also integrate the fixes of #878? --------------------------------------------------------------------------- by fabpot at 2012-11-06T08:30:55Z @Tobion Let's do one thing at a time. --------------------------------------------------------------------------- by char101 at 2012-11-06T08:59:30Z @Tobion AFAIK, unlike the PHP implementation, the C implementation does not automatically convert array key type. --------------------------------------------------------------------------- by char101 at 2012-11-06T09:27:54Z @fabpot How about the lineno variable? Should I just set it to 0 or is there any function that can be called to obtain it? ```php if (-1 === $this->lineno || null === $this->filename) { $this->guessTemplateInfo(); } ``` --------------------------------------------------------------------------- by fabpot at 2012-11-06T09:32:09Z You need to keep `-1` for the line. --------------------------------------------------------------------------- by char101 at 2012-11-06T09:36:56Z If `$lineno` is `-1`, wouldn't `$this->guessTemplateInfo()` still be called? --------------------------------------------------------------------------- by fabpot at 2012-11-06T09:45:34Z Yes, but the template name will not be guessed. So, there is a performance overhead for the line guessing, but not for the template name guessing.
…
…
…
Twig, the flexible, fast, and secure template language for PHP
Twig is a template language for PHP, released under the new BSD license (code and documentation).
Twig uses a syntax similar to the Django and Jinja template languages which inspired the Twig runtime environment.
More Information
Read the documentation for more information.
Description
Languages
PHP
99.9%
