diff --git a/src/Environment.php b/src/Environment.php index 979fcb0..d22fbc3 100755 --- a/src/Environment.php +++ b/src/Environment.php @@ -879,7 +879,7 @@ private function query_insert($query) return $this->set_error('Invalid INSERT Query '); $result = $this->query_select($the_rest); $dataRows = []; - while (($values = $result->fetchRow()) !== false) { + while (($values = $result->fetchRow()) !== null) { $row = array_map( function ($value) { if (is_string($value)) $value = "'$value'"; diff --git a/src/ResultSet.php b/src/ResultSet.php index 797afd5..c409963 100644 --- a/src/ResultSet.php +++ b/src/ResultSet.php @@ -52,7 +52,7 @@ public function fetchAll($type = self::FETCH_ASSOC) public function fetchArray($type = self::FETCH_ASSOC) { if (!$this->dataCursor->valid()) { - return false; + return null; } $entry = $this->dataCursor->current(); @@ -86,14 +86,14 @@ public function fetchSingle($column = 0) $type = is_numeric($column) ? self::FETCH_NUM : self::FETCH_ASSOC; $row = $this->fetchArray($type); - return $row !== false && array_key_exists($column, $row) ? $row[$column] : false; + return $row !== null && array_key_exists($column, $row) ? $row[$column] : null; } public function fetchObject() { $row = $this->fetchAssoc(); - if ($row === false) { - return false; + if ($row === null) { + return null; } return (object) $row; diff --git a/tests/ResultSetTest.php b/tests/ResultSetTest.php index b1a6faf..9988be2 100644 --- a/tests/ResultSetTest.php +++ b/tests/ResultSetTest.php @@ -53,7 +53,7 @@ public function testFetchAssoc() $results = new ResultSet(self::$columns, self::$entries); $i = 0; - while (($row = $results->fetchAssoc()) !== false) { + while (($row = $results->fetchAssoc()) !== null) { $this->assertEquals(array_combine(self::$columns, self::$entries[$i++]), $row); } $this->assertEquals(count(self::$entries), $i); @@ -64,7 +64,7 @@ public function testFetchRow() $results = new ResultSet(self::$columns, self::$entries); $i = 0; - while (($row = $results->fetchRow()) !== false) { + while (($row = $results->fetchRow()) !== null) { $this->assertEquals(self::$entries[$i++], $row); } $this->assertEquals(count(self::$entries), $i); @@ -75,7 +75,7 @@ public function testFetchBoth() $results = new ResultSet(self::$columns, self::$entries); $i = 0; - while (($row = $results->fetchBoth()) !== false) { + while (($row = $results->fetchBoth()) !== null) { $entry = self::$entries[$i++]; $this->assertEquals(array_merge($entry, array_combine(self::$columns, $entry)), $row); } @@ -85,7 +85,7 @@ public function testFetchBoth() public function testFetchSingleEmpty() { $results = new ResultSet(self::$columns, array()); - $this->assertFalse($results->fetchSingle(5)); + $this->assertnull($results->fetchSingle(5)); } public function testFetchSingleIndex() @@ -105,7 +105,7 @@ public function testFetchObject() $results = new ResultSet(self::$columns, self::$entries); $i = 0; - while (($row = $results->fetchObject()) !== false) { + while (($row = $results->fetchObject()) !== null) { $this->assertEquals((object) array_combine(self::$columns, self::$entries[$i++]), $row); } $this->assertEquals(count(self::$entries), $i); @@ -124,7 +124,7 @@ public function testDataSeek() $results = new ResultSet(self::$columns, self::$entries); $success = $results->dataSeek(7); - $this->assertTrue($success !== false); + $this->assertTrue($success !== null); $row = $results->fetchRow(); $this->assertEquals(self::$entries[7], $row); diff --git a/tests/SQL/ShowTest.php b/tests/SQL/ShowTest.php index a1c8665..5eceb0c 100644 --- a/tests/SQL/ShowTest.php +++ b/tests/SQL/ShowTest.php @@ -39,7 +39,7 @@ public function testShowDatabasesNone() $this->assertTrue($result !== false); $result = $this->fsql->fetch_row($result); - $this->assertEquals(false, $result); + $this->assertEquals(null, $result); } public function testShowDatabases() @@ -65,7 +65,7 @@ public function testShowTablesNone() $this->assertTrue($result !== false); $result = $this->fsql->fetch_row($result); - $this->assertEquals(false, $result); + $this->assertEquals(null, $result); } public function testShowTables()