From 8f33ca71118ea5866f06deaba76c4120c0f3d88c Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Tue, 14 Dec 2010 09:08:17 +0100 Subject: [PATCH] fixed filename not being added to syntax error messages --- CHANGELOG | 1 + lib/Twig/Error.php | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 87d087f..e4b4d2d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 diff --git a/lib/Twig/Error.php b/lib/Twig/Error.php index e9b60c3..6eb9130 100644 --- a/lib/Twig/Error.php +++ b/lib/Twig/Error.php @@ -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); } -- 1.7.2.5