Prevent deprecation notices for implode, json_encode and substr modifiers

* Prevent deprecation notices for implode, json_encode and substr modifiers.
* unit tests
This commit is contained in:
Simon Wisselink
2024-02-26 14:33:47 +01:00
committed by GitHub
parent 326b2da8da
commit de1bc77f7f
7 changed files with 209 additions and 0 deletions

View File

@@ -0,0 +1,15 @@
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifier
*/
function smarty_modifier_implode($values, $separator = '')
{
if (is_array($separator)) {
return implode((string) ($values ?? ''), (array) $separator);
}
return implode((string) ($separator ?? ''), (array) $values);
}