diff --git a/change_log.txt b/change_log.txt index b270d6b4..5f639595 100644 --- a/change_log.txt +++ b/change_log.txt @@ -2,6 +2,7 @@ 21.01.2015 - bugfix clearCompiledTemplates(), clearAll() and clear() could try to delete whole drive at wrong path permissions because realpath() fail (forum 25397) + - bugfix 'self::' and 'parent::' was interpreted in template syntax as static class 04.01.2015 - push last weeks changes to github diff --git a/lexer/smarty_internal_templateparser.y b/lexer/smarty_internal_templateparser.y index a3194ac8..a61065af 100644 --- a/lexer/smarty_internal_templateparser.y +++ b/lexer/smarty_internal_templateparser.y @@ -924,7 +924,7 @@ value(res) ::= NAMESPACE(c). { // static class access value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). { - if (!$this->security || isset($this->smarty->registered_classes[c]) || $this->smarty->security_policy->isTrustedStaticClass(c, $this->compiler)) { + if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || isset($this->smarty->registered_classes[c]) || $this->smarty->security_policy->isTrustedStaticClass(c, $this->compiler))) { if (isset($this->smarty->registered_classes[c])) { res = $this->smarty->registered_classes[c].'::'.s; } else { diff --git a/libs/sysplugins/smarty_internal_templateparser.php b/libs/sysplugins/smarty_internal_templateparser.php index c06c7cf3..b2fd6d34 100644 --- a/libs/sysplugins/smarty_internal_templateparser.php +++ b/libs/sysplugins/smarty_internal_templateparser.php @@ -1,5 +1,4 @@ security || isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + - 2]->minor]) || $this->smarty->security_policy->isTrustedStaticClass($this->yystack[$this->yyidx + - 2]->minor, $this->compiler)) { + if (!in_array(strtolower($this->yystack[$this->yyidx + - 2]->minor), array('self', 'parent')) && (!$this->security || isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + - 2]->minor]) || $this->smarty->security_policy->isTrustedStaticClass($this->yystack[$this->yyidx + - 2]->minor, $this->compiler))) { if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + - 2]->minor])) { $this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + - 2]->minor] . '::' . $this->yystack[$this->yyidx + 0]->minor; } else {