Fabien Potencier cfb341f4ba 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.
2012-11-06 12:54:36 +01:00
2012-04-23 23:30:30 +02:00
2012-10-19 12:48:39 +02:00
2012-04-23 23:34:16 +02:00

Twig, the flexible, fast, and secure template language for PHP

Build Status

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.

Languages
PHP 99.9%