mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 02:14:26 +02:00
Trigger deprecation notice on unregistered static class methods as well.
This commit is contained in:
@@ -785,6 +785,9 @@ value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). {
|
|||||||
if (isset($this->smarty->registered_classes[c])) {
|
if (isset($this->smarty->registered_classes[c])) {
|
||||||
res = $this->smarty->registered_classes[c].'::'.s[0].s[1];
|
res = $this->smarty->registered_classes[c].'::'.s[0].s[1];
|
||||||
} else {
|
} 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);
|
||||||
res = c.'::'.s[0].s[1];
|
res = c.'::'.s[0].s[1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -2425,6 +2425,9 @@ public static $yy_action = array(
|
|||||||
if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor])) {
|
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[0].$this->yystack[$this->yyidx + 0]->minor[1];
|
$this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor].'::'.$this->yystack[$this->yyidx + 0]->minor[0].$this->yystack[$this->yyidx + 0]->minor[1];
|
||||||
} else {
|
} else {
|
||||||
|
trigger_error('Using unregistered static method "' . $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor[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);
|
||||||
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor[0].$this->yystack[$this->yyidx + 0]->minor[1];
|
$this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor[0].$this->yystack[$this->yyidx + 0]->minor[1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@@ -223,6 +223,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
|
|||||||
array('{$a = date("Y", $value)}{$a}', strtotime("01-01-2030"), 2030),
|
array('{$a = date("Y", $value)}{$a}', strtotime("01-01-2030"), 2030),
|
||||||
array('{$a = PhpFunctionTest::sayHi($value)}{$a}', 'mario', 'hi mario'),
|
array('{$a = PhpFunctionTest::sayHi($value)}{$a}', 'mario', 'hi mario'),
|
||||||
array('{$a = pass($value)}{$a}', 'mario', 'mario'),
|
array('{$a = pass($value)}{$a}', 'mario', 'mario'),
|
||||||
|
array('{$a = 1}{$b = Closure::fromCallable($value)}{$a}', 'strlen', 1),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user