mirror of
https://github.com/smarty-php/smarty.git
synced 2025-07-31 16:37:14 +02:00
Yes, this fix is easier.
This commit is contained in:
@@ -759,19 +759,6 @@ value(res) ::= varindexed(vi) DOUBLECOLON static_class_access(r). {
|
||||
res = $prefixVar .'::'.r[0].r[1];
|
||||
}
|
||||
|
||||
value(res) ::= varindexed(vi) DOUBLECOLON static_class_constant(r). {
|
||||
if ($this->security && $this->security->static_classes !== array()) {
|
||||
$this->compiler->trigger_template_error('dynamic static class not allowed by security setting');
|
||||
}
|
||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||
if (vi['var'] === '\'smarty\'') {
|
||||
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ". $this->compiler->compileTag('private_special_variable',array(),vi['smarty_internal_index']).';?>');
|
||||
} else {
|
||||
$this->compiler->appendPrefixCode("<?php {$prefixVar} = ". $this->compiler->compileVariable(vi['var']).vi['smarty_internal_index'].';?>');
|
||||
}
|
||||
res = $prefixVar .'::'.r[0];
|
||||
}
|
||||
|
||||
// Smarty tag
|
||||
value(res) ::= smartytag(st). {
|
||||
$prefixVar = $this->compiler->getNewPrefixVariable();
|
||||
@@ -792,29 +779,17 @@ value(res) ::= NAMESPACE(c). {
|
||||
value(res) ::= arraydef(a). {
|
||||
res = a;
|
||||
}
|
||||
|
||||
// static class constant access
|
||||
value(res) ::= ns1(c)DOUBLECOLON static_class_constant(s). {
|
||||
if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess(c, s, $this->compiler))) {
|
||||
if (isset($this->smarty->registered_classes[c])) {
|
||||
res = $this->smarty->registered_classes[c].'::'.s[0];
|
||||
} else {
|
||||
res = c.'::'.s[0];
|
||||
}
|
||||
} else {
|
||||
$this->compiler->trigger_template_error ('static class \''.c.'\' is undefined or not allowed by security setting');
|
||||
}
|
||||
}
|
||||
|
||||
// other static class access
|
||||
// static class access
|
||||
value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). {
|
||||
if (!in_array(strtolower(c), array('self', 'parent')) && (!$this->security || $this->security->isTrustedStaticClassAccess(c, s, $this->compiler))) {
|
||||
if (isset($this->smarty->registered_classes[c])) {
|
||||
res = $this->smarty->registered_classes[c].'::'.s[0].s[1];
|
||||
} else {
|
||||
trigger_error('Using unregistered static method "' . c.'::'.s[0] . '" in a template is deprecated and will be ' .
|
||||
'removed in a future release. Use Smarty::registerClass to explicitly register ' .
|
||||
'a class for access.', E_USER_DEPRECATED);
|
||||
if (s[2] === 'method') {
|
||||
trigger_error('Using unregistered static method "' . c.'::'.s[0] . '" in a template is deprecated and will be ' .
|
||||
'removed in a future release. Use Smarty::registerClass to explicitly register ' .
|
||||
'a class for access.', E_USER_DEPRECATED);
|
||||
}
|
||||
res = c.'::'.s[0].s[1];
|
||||
}
|
||||
} else {
|
||||
@@ -1138,11 +1113,6 @@ modparameter(res) ::= COLON array(mp). {
|
||||
res = array(mp);
|
||||
}
|
||||
|
||||
// static class constant
|
||||
static_class_constant(res) ::= ID(v). {
|
||||
res = array(v);
|
||||
}
|
||||
|
||||
// static class methode call
|
||||
static_class_access(res) ::= method(m). {
|
||||
res = array(m, '', 'method');
|
||||
@@ -1153,6 +1123,11 @@ static_class_access(res) ::= method(m) objectchain(oc). {
|
||||
res = array(m, oc, 'method');
|
||||
}
|
||||
|
||||
// static class constant
|
||||
static_class_access(res) ::= ID(v). {
|
||||
res = array(v, '', 'constant');
|
||||
}
|
||||
|
||||
// static class variables
|
||||
static_class_access(res) ::= DOLLARID(v) arrayindex(a). {
|
||||
res = array(v, a, 'property');
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user