Fixing bug where end limit would not be calculated
authormwalker <mwalker@wikimedia.org>
Mon, 24 Sep 2012 23:35:24 +0000 (16:35 -0700)
committerGerrit Code Review <gerrit@wikimedia.org>
Wed, 26 Sep 2012 05:04:36 +0000 (05:04 +0000)
In the pager object, if the query was constructed
such that the index was a fully qualified field then
the 'past the end' index reference would not get
computed.

This is because $mIndexField stores the FQ field name
but $mPastTheEndRow is indexed on the non FQ name.
Therefore a warning would be generated due to a non
existent array key.

Change-Id: I52e1cbc8f7dad07de1ba5ba3bdfa2d107dfb4d93

includes/Pager.php

index 96ba446..077430d 100644 (file)
@@ -287,8 +287,7 @@ abstract class IndexPager extends ContextSource implements Pager {
                        if ( $numRows > $this->mLimit && $numRows > 1 ) {
                                $res->seek( $numRows - 1 );
                                $this->mPastTheEndRow = $res->fetchObject();
-                               $indexField = $this->mIndexField;
-                               $this->mPastTheEndIndex = $this->mPastTheEndRow->$indexField;
+                               $this->mPastTheEndIndex = $this->mPastTheEndRow->$indexColumn;
                                $res->seek( $numRows - 2 );
                                $row = $res->fetchRow();
                                $lastIndex = $row[$indexColumn];