From: Fabien Potencier Date: Tue, 6 Nov 2012 11:54:36 +0000 (+0100) Subject: merged branch char101/nativeext-exception-info (PR #885) X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=cfb341f4baf152c710a7e5b885230495125168c3;p=web%2Fkonrad%2Ftwig.git merged branch char101/nativeext-exception-info (PR #885) This PR was merged into the master branch. Commits ------- db13b66 Pass lineno and filename to Twig_Error constructor feee667 Merge branch 'nativeext-exception-info' of https://github.com/fabpot/Twig into nativeext-exception-info adb31d4 Call Twig_Error constructor d4a8c8b added tests for exceptions thrown in Twig_Template::getAttribute() 1b82bf7 Add template filename for the rest of the exception 5675140 Handle NULL filename 71f64bc Add 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. --- cfb341f4baf152c710a7e5b885230495125168c3