diff --git a/classes/helpers/FrmAppHelper.php b/classes/helpers/FrmAppHelper.php index 7c1e6f52e1..4b3ba7ff93 100644 --- a/classes/helpers/FrmAppHelper.php +++ b/classes/helpers/FrmAppHelper.php @@ -3682,29 +3682,25 @@ public static function maybe_unserialize_array( $value ) { * Decode a JSON string. * Do not switch shortcodes like [24] to array unless intentional ie XML values. * - * @param mixed $string - * @param bool $single_to_array + * @param array|string|null $string + * @param bool $single_to_array * - * @return mixed + * @return array|string|null */ public static function maybe_json_decode( $string, $single_to_array = true ) { if ( is_array( $string ) || is_null( $string ) ) { return $string; } - $new_string = json_decode( $string, true ); - - if ( function_exists( 'json_last_error' ) ) { - // php 5.3+ - $single_value = false; + $new_string = json_decode( $string, true ); + $single_value = false; - if ( ! $single_to_array ) { - $single_value = is_array( $new_string ) && count( $new_string ) === 1 && isset( $new_string[0] ); - } + if ( ! $single_to_array ) { + $single_value = is_array( $new_string ) && count( $new_string ) === 1 && isset( $new_string[0] ); + } - if ( json_last_error() === JSON_ERROR_NONE && is_array( $new_string ) && ! $single_value ) { - $string = $new_string; - } + if ( json_last_error() === JSON_ERROR_NONE && is_array( $new_string ) && ! $single_value ) { + $string = $new_string; } return $string; diff --git a/psalm.xml b/psalm.xml index 2fdb84e2ac..0b30fa49cb 100644 --- a/psalm.xml +++ b/psalm.xml @@ -520,8 +520,14 @@ + + + + + +