From 331cd25c3ebea3c4754872ae8b0958913395083d Mon Sep 17 00:00:00 2001 From: Damien Matabon Date: Tue, 31 Jul 2018 12:03:25 +0200 Subject: [PATCH] Fix queries equalTo with null values --- src/Parse/ParseQuery.php | 6 +----- tests/Parse/ParseQueryTest.php | 11 ++++++++++- 2 files changed, 11 insertions(+), 6 deletions(-) mode change 100755 => 100644 src/Parse/ParseQuery.php diff --git a/src/Parse/ParseQuery.php b/src/Parse/ParseQuery.php old mode 100755 new mode 100644 index c024aaf6..493b2bc0 --- a/src/Parse/ParseQuery.php +++ b/src/Parse/ParseQuery.php @@ -112,11 +112,7 @@ public function get($objectId, $useMasterKey = false) */ public function equalTo($key, $value) { - if ($value === null) { - $this->doesNotExist($key); - } else { - $this->where[$key] = $value; - } + $this->where[$key] = $value; return $this; } diff --git a/tests/Parse/ParseQueryTest.php b/tests/Parse/ParseQueryTest.php index d773bb9c..2d278b1c 100644 --- a/tests/Parse/ParseQueryTest.php +++ b/tests/Parse/ParseQueryTest.php @@ -2115,11 +2115,20 @@ function ($i) { return $obj; } ); + $this->saveObjects( + 2, + function ($i) { + $obj = ParseObject::create('TestObject'); + $obj->set('num', null); + + return $obj; + } + ); $query = new ParseQuery('TestObject'); $query->equalTo('num', null); $results = $query->find(); $this->assertEquals( - 0, + 2, count($results), 'Did not return correct number of objects.' );