| @@ -8,8 +8,13 @@ | ||
| 8 | 8 | * @param string $string |
| 9 | 9 | * @return bool |
| 10 | 10 | */ |
| 11 | 11 | public static function is_string_json( $string ) { |
| 12 | + | |
| 13 | + if ( ! is_string( $string ) || trim( $string ) === '' ) { | |
| 14 | + return false; | |
| 15 | + } | |
| 16 | + | |
| 12 | 17 | $decoded = json_decode( $string ); |
| 13 | 18 | |
| 14 | 19 | return is_object( $decoded ) || is_array( $decoded ); |
| 15 | 20 | } |