summaryrefslogtreecommitdiff
path: root/inc/lib/Twig/Error.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/lib/Twig/Error.php')
-rw-r--r--inc/lib/Twig/Error.php6
1 files changed, 5 insertions, 1 deletions
diff --git a/inc/lib/Twig/Error.php b/inc/lib/Twig/Error.php
index 72d91a98..61a4cfa0 100644
--- a/inc/lib/Twig/Error.php
+++ b/inc/lib/Twig/Error.php
@@ -186,6 +186,7 @@ class Twig_Error extends Exception
protected function guessTemplateInfo()
{
$template = null;
+ $templateClass = null;
if (version_compare(phpversion(), '5.3.6', '>=')) {
$backtrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS | DEBUG_BACKTRACE_PROVIDE_OBJECT);
@@ -195,8 +196,11 @@ class Twig_Error extends Exception
foreach ($backtrace as $trace) {
if (isset($trace['object']) && $trace['object'] instanceof Twig_Template && 'Twig_Template' !== get_class($trace['object'])) {
- if (null === $this->filename || $this->filename == $trace['object']->getTemplateName()) {
+ $currentClass = get_class($trace['object']);
+ $isEmbedContainer = 0 === strpos($templateClass, $currentClass);
+ if (null === $this->filename || ($this->filename == $trace['object']->getTemplateName() && !$isEmbedContainer)) {
$template = $trace['object'];
+ $templateClass = get_class($trace['object']);
}
}
}