From da2f406d4d54b3210f16b39ef091e4f8760d2e24 Mon Sep 17 00:00:00 2001 From: Hermanni Piirainen Date: Mon, 29 Jan 2024 18:40:35 +0200 Subject: [PATCH 1/2] Fix calling json_decode with non-string input --- CHANGELOG.md | 8 ++++++-- plugin.php | 2 +- src/Util.php | 4 ++++ 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 893377b..8fd0bbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,11 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ## [Unreleased] -### Changed +## [Released] + +## [1.3.1] - 2024-01-29 +### Changed - Enabled PHP 8.0 and PHP 8.1 usage #18 -## [Released] +### Fixed +- Fix PHP 8 deprecation. ## [1.3.0] - 2023-08-01 - Fixed the issue https://github.com/devgeniem/wp-oopi/issues/23 If OOPI_IGNORE_SSL has been enabled and the certificate on the source site is invalid, the exif_imagetype() function cannot be used in the AttachmentImporter. diff --git a/plugin.php b/plugin.php index b45d451..90cc866 100644 --- a/plugin.php +++ b/plugin.php @@ -3,7 +3,7 @@ * Plugin Name: Oopi * Plugin URI: https://github.com/devgeniem/wp-oopi * Description: Oopi is an object-oriented developer friendly WordPress importer. - * Version: 1.3.0 + * Version: 1.3.1 * Author: Geniem * Author URI: http://www.github.com/devgeniem * License: GPL3 diff --git a/src/Util.php b/src/Util.php index 8122f27..00f7ce1 100644 --- a/src/Util.php +++ b/src/Util.php @@ -22,6 +22,10 @@ class Util { */ public static function is_json( $data ) { + if ( ! is_string( $data ) ) { + return false; + } + json_decode( $data ); return ( json_last_error() === JSON_ERROR_NONE ); From 448b2c2dbd56c889697f7e961a78fdf728b9d470 Mon Sep 17 00:00:00 2001 From: Hermanni Piirainen Date: Mon, 29 Jan 2024 18:42:35 +0200 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fd0bbc..743477c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Enabled PHP 8.0 and PHP 8.1 usage #18 ### Fixed -- Fix PHP 8 deprecation. +- Fix PHP 8 deprecation. #25 ## [1.3.0] - 2023-08-01 - Fixed the issue https://github.com/devgeniem/wp-oopi/issues/23 If OOPI_IGNORE_SSL has been enabled and the certificate on the source site is invalid, the exif_imagetype() function cannot be used in the AttachmentImporter.