Adding better handling of json alike filter values

This commit is contained in:
Georgiy Sadovnikov 2023-11-10 18:38:55 +03:00
parent 48d85cfed5
commit 27f32804cc
1 changed files with 3 additions and 1 deletions

View File

@ -113,7 +113,9 @@ function apply_filters($token_prefix, $field_name, array $tokens, $val, $add_ass
if(function_exists($filter_func))
{
$args = null;
if($args_json && (strpos($args_json, '[') === 0 || strpos($args_json, '{') === 0))
if($args_json &&
((strpos($args_json, '[') === 0 && strlen($args_json) > 1 && $args_json[strlen($args_json)-1] === ']') ||
(strpos($args_json, '{') === 0 && strlen($args_json) > 1 && $args_json[strlen($args_json)-1] === '}')))
{
$args = json_decode($args_json, true);
if(!is_array($args))