diff --git a/CHANGELOG.md b/CHANGELOG.md index 4f799e49..8c01934e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ### Fixed - ensure numeric issues in const are correctly evaluated ([#805](https://github.com/jsonrainbow/json-schema/pull/805)) +- fix 6.3.0 regression with comparison of null values during validation ([#806](https://github.com/jsonrainbow/json-schema/issues/806)) ## [6.3.0] - 2025-03-14 ### Fixed diff --git a/src/JsonSchema/Tool/DeepComparer.php b/src/JsonSchema/Tool/DeepComparer.php index 70b16ef0..fb99b141 100644 --- a/src/JsonSchema/Tool/DeepComparer.php +++ b/src/JsonSchema/Tool/DeepComparer.php @@ -12,6 +12,10 @@ class DeepComparer */ public static function isEqual($left, $right): bool { + if ($left === null && $right === null) { + return true; + } + $isLeftScalar = is_scalar($left); $isRightScalar = is_scalar($right); diff --git a/tests/Tool/DeepComparerTest.php b/tests/Tool/DeepComparerTest.php index 112ace66..cb7b02aa 100644 --- a/tests/Tool/DeepComparerTest.php +++ b/tests/Tool/DeepComparerTest.php @@ -27,6 +27,7 @@ public function testComparesDeepEqualForNotEqualLeftAndRight($left, $right): voi public function equalDataProvider(): \Generator { + yield 'Null null' => [null, null]; yield 'Boolean true' => [true, true]; yield 'Boolean false' => [false, false]; @@ -49,6 +50,7 @@ public function equalDataProvider(): \Generator public function notEqualDataProvider(): \Generator { + yield 'Null true' => [null, true]; yield 'Boolean true/false' => [true, false]; yield 'Integer one/two' => [1, 2];