From 84ef9af3c437cf173afe2a5f7c0f9ce1b17529d4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Thu, 2 Nov 2017 16:18:43 +0100 Subject: [PATCH] Fix count(): Parameter must be an array or an object that implements Countable ... --- src/JsonPatch.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JsonPatch.php b/src/JsonPatch.php index d180e5a..f77192c 100644 --- a/src/JsonPatch.php +++ b/src/JsonPatch.php @@ -261,7 +261,7 @@ private static function is_index($part) private static function diff_values($path, $value, $other) { // manually handle the {}-looks-like-[] case, when other is associative - if ((count($value) == 0 || count($other) == 0) + if ((!$value || !$other) && (self::is_associative($value) || self::is_associative($other))) { return self::diff_assoc($path, $value, $other);