From 27f32804cc0650abd51444d6349120a8e69b455c Mon Sep 17 00:00:00 2001 From: Georgiy Sadovnikov Date: Fri, 10 Nov 2023 18:38:55 +0300 Subject: [PATCH] Adding better handling of json alike filter values --- src/codegen.inc.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/codegen.inc.php b/src/codegen.inc.php index b87c96f..f2d1998 100644 --- a/src/codegen.inc.php +++ b/src/codegen.inc.php @@ -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))