From 73776463f7dd98d0008d22c8c2b24651308f2a04 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Fri, 15 May 2009 02:49:06 +0000 Subject: [PATCH] Fix breakage of SQLite ResultWrapper due to r45769. The "result" member in SQLite is actually an array and so passing by value to DatabaseSqlite::fetchObject() makes it fail to iterate. We can't really pass it by reference since that's an E_STRICT error due to a parameter type mismatch with Database. Pass the ResultWrapper instead. This means that nothing at all should be passing bare result objects/arrays to Database*::fetchObject() anymore. The "instanceof ResultWrapper" logic can be removed in a subsequent commit. It can stay in this one for now for safer backport to 1.15. --- includes/db/Database.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/includes/db/Database.php b/includes/db/Database.php index 7f648626ba..8d3d25a7b3 100644 --- a/includes/db/Database.php +++ b/includes/db/Database.php @@ -2764,7 +2764,7 @@ class ResultWrapper implements Iterator { * Get the number of rows in a result object */ function numRows() { - return $this->db->numRows( $this->result ); + return $this->db->numRows( $this ); } /** @@ -2777,7 +2777,7 @@ class ResultWrapper implements Iterator { * @throws DBUnexpectedError Thrown if the database returns an error */ function fetchObject() { - return $this->db->fetchObject( $this->result ); + return $this->db->fetchObject( $this ); } /** @@ -2789,14 +2789,14 @@ class ResultWrapper implements Iterator { * @throws DBUnexpectedError Thrown if the database returns an error */ function fetchRow() { - return $this->db->fetchRow( $this->result ); + return $this->db->fetchRow( $this ); } /** * Free a result object */ function free() { - $this->db->freeResult( $this->result ); + $this->db->freeResult( $this ); unset( $this->result ); unset( $this->db ); } @@ -2806,7 +2806,7 @@ class ResultWrapper implements Iterator { * See mysql_data_seek() */ function seek( $row ) { - $this->db->dataSeek( $this->result, $row ); + $this->db->dataSeek( $this, $row ); } /********************* @@ -2817,7 +2817,7 @@ class ResultWrapper implements Iterator { function rewind() { if ($this->numRows()) { - $this->db->dataSeek($this->result, 0); + $this->db->dataSeek($this, 0); } $this->pos = 0; $this->currentRow = null; -- 2.20.1