Compare commits

...

2 Commits

Author SHA1 Message Date
Simon Wisselink 86f303b9f9 Yes, this fix is easier. 2024-07-05 23:35:26 +02:00
Simon Wisselink cba469bf3e Initial attempt. I think we can do this with less impact on compilation flow and thus less risk for stability. 2024-07-05 11:12:44 +02:00
3 changed files with 611 additions and 590 deletions
+6 -4
View File
@@ -785,9 +785,11 @@ value(res) ::= ns1(c)DOUBLECOLON static_class_access(s). {
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 {
@@ -1123,7 +1125,7 @@ static_class_access(res) ::= method(m) objectchain(oc). {
// static class constant
static_class_access(res) ::= ID(v). {
res = array(v, '');
res = array(v, '', 'constant');
}
// static class variables
File diff suppressed because it is too large Load Diff
@@ -255,8 +255,9 @@ class PhpFunctionTest extends PHPUnit_Smarty
}
if ($shouldTriggerDeprecationNotice) {
$this->assertStringContainsString('Using unregistered function', $errorMessage);
$this->assertStringContainsString('Using unregistered ', $errorMessage);
} else {
$this->assertEquals('', $errorMessage);
$this->assertEquals($expected, $output);
$this->assertEquals('', $errorMessage);
}
@@ -295,6 +296,9 @@ class PhpFunctionTest extends PHPUnit_Smarty
['{$a|addslashes}', '', true],
['{$a|sha1}', '', true],
['{$a|get_parent_class}', '', true],
['{StaticMethodsTesterClass::giveMeEmptyString($a)}', '', true],
['{StaticMethodsTesterClass::EMPTY_STRING}', '', false],
];
}
@@ -326,3 +330,12 @@ class TestIsset {
return $v;
}
}
class StaticMethodsTesterClass {
const EMPTY_STRING = '';
public static function giveMeEmptyString($data) {
return '';
}
}