TablePager: put parent construct call back at end
authorElliott Eggleston <ejegg@ejegg.com>
Tue, 27 Aug 2019 03:42:07 +0000 (22:42 -0500)
committerAndrew Green <andrew.green.df@gmail.com>
Tue, 27 Aug 2019 04:43:01 +0000 (23:43 -0500)
Restores position of parent constructor call, changed in commit
I082152b64141f1a.

The parent constructor calls getIndexField(), which depends on the
mSort value already being set.

Bug: T231261
Change-Id: If07f10075a51fbbe9de24464cb6844faaad94780

includes/pager/TablePager.php

index 7f54617..36ed9aa 100644 (file)
@@ -35,8 +35,6 @@ abstract class TablePager extends IndexPager {
        protected $mCurrentRow;
 
        public function __construct( IContextSource $context = null, LinkRenderer $linkRenderer = null ) {
-               parent::__construct( $context, $linkRenderer );
-
                $this->mSort = $this->getRequest()->getText( 'sort' );
                if ( !array_key_exists( $this->mSort, $this->getFieldNames() )
                        || !$this->isFieldSortable( $this->mSort )
@@ -48,6 +46,9 @@ abstract class TablePager extends IndexPager {
                } elseif ( $this->getRequest()->getBool( 'desc' ) ) {
                        $this->mDefaultDirection = IndexPager::DIR_DESCENDING;
                } /* Else leave it at whatever the class default is */
+
+               // Parent constructor needs mSort set, so we call it last
+               parent::__construct( $context, $linkRenderer );
        }
 
        /**