fixed filename not being added to syntax error messages

This commit is contained in:
Fabien Potencier
2010-12-14 09:08:17 +01:00
parent 4505200d9f
commit 8f33ca7111
2 changed files with 3 additions and 2 deletions
+1
View File
@@ -15,6 +15,7 @@ Backward incompatibilities:
Changes:
* fixed filename not being added to syntax error messages
* added the autoescape option to enable/disable autoescaping
* removed the newline after a comment (mimicks PHP behavior)
* added a syntax error exception when parent block is used on a template that does not extend another one
+2 -2
View File
@@ -21,7 +21,7 @@ class Twig_Error extends Exception
protected $filename;
protected $rawMessage;
public function __construct($message, $lineno = -1, $filename = 'n/a')
public function __construct($message, $lineno = -1, $filename = null)
{
$this->lineno = $lineno;
$this->filename = $filename;
@@ -48,7 +48,7 @@ class Twig_Error extends Exception
{
$this->message = $this->rawMessage;
if ('n/a' != $this->filename) {
if (null !== $this->filename) {
$this->message .= sprintf(' in %s', $this->filename);
}