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,12 @@
<?php
/**
* Smarty plugin
*
* @package Smarty
* @subpackage PluginsModifierCompiler
*/
function smarty_modifiercompiler_substr($params) {
return 'substr((string) ' . $params[0] . ', (int) ' . $params[1] .
(isset($params[2]) ? ', (int) ' . $params[2] : '') . ')';
}