From: Nami-Doc Date: Sat, 31 Mar 2012 16:45:34 +0000 (+0300) Subject: fix a bug where when an error would be thrown through the loader (Twig_Error_Loader... X-Git-Url: http://git.silmor.de/gitweb/?a=commitdiff_plain;h=36618fe10161075129f9281878f85ca1a71ad261;p=web%2Fkonrad%2Ftwig.git fix a bug where when an error would be thrown through the loader (Twig_Error_Loader by Twig_Loader_Filesystem, ie) the $trace['line'] would not be set (since we're not in a template) --- diff --git a/lib/Twig/Error.php b/lib/Twig/Error.php index c1b9f32..45d164a 100755 --- a/lib/Twig/Error.php +++ b/lib/Twig/Error.php @@ -163,9 +163,11 @@ class Twig_Error extends Exception protected function guessTemplateLine($trace) { - foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) { - if (isset($trace['line']) && $codeLine <= $trace['line']) { - return $templateLine; + if (isset($trace['line'])) { + foreach ($trace['object']->getDebugInfo() as $codeLine => $templateLine) { + if (isset($trace['line']) && $codeLine <= $trace['line']) { + return $templateLine; + } } }