mirror of
https://github.com/smarty-php/smarty.git
synced 2025-07-30 07:57:14 +02:00
Fixed that using count() would trigger a deprecation notice.
This commit is contained in:
1
changelog/count.md
Normal file
1
changelog/count.md
Normal file
@ -0,0 +1 @@
|
||||
- Fixed that using `count()` would trigger a deprecation notice. [#813](https://github.com/smarty-php/smarty/issues/813)
|
@ -658,7 +658,7 @@ abstract class Smarty_Internal_TemplateCompilerBase
|
||||
if (
|
||||
!$this->smarty->loadPlugin('smarty_modifiercompiler_' . $name)
|
||||
&& !isset($this->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$name])
|
||||
&& !in_array($name, ['time', 'join', 'is_array', 'in_array'])
|
||||
&& !in_array($name, ['time', 'join', 'is_array', 'in_array', 'count'])
|
||||
) {
|
||||
trigger_error('Using unregistered function "' . $name . '" in a template is deprecated and will be ' .
|
||||
'removed in a future release. Use Smarty::registerPlugin to explicitly register ' .
|
||||
|
@ -247,6 +247,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
|
||||
$this->smarty->assign('f', 3.14);
|
||||
|
||||
$errorMessage = '';
|
||||
$output = '';
|
||||
|
||||
try {
|
||||
$output = $this->smarty->fetch('string:' . $strTemplateSource);
|
||||
@ -282,6 +283,7 @@ class PhpFunctionTest extends PHPUnit_Smarty
|
||||
['{$a|substr:-1}', 'a', false],
|
||||
['{$f|substr:-1}', '4', false],
|
||||
['{$ar|count}', '2', false],
|
||||
['{count($ar)}', '2', false],
|
||||
['{foreach "."|explode:$f as $n}{$n}{/foreach}', '314', false],
|
||||
['{"-"|implode:$ar}', '1-2', false],
|
||||
['{"-"|join:$ar}', '1-2', false],
|
||||
|
Reference in New Issue
Block a user