From e8f50270b7e7bf212112dfab66930a2a12c37b15 Mon Sep 17 00:00:00 2001 From: sbassett Date: Tue, 24 Aug 2021 15:12:13 -0500 Subject: [PATCH] Coalesce page_id values to false in event of non-object error Bug: T289351 Change-Id: I19d6607886d4d5b61cb760f9d74066d29f34563e --- includes/specials/SpecialWhatLinksHere.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/includes/specials/SpecialWhatLinksHere.php b/includes/specials/SpecialWhatLinksHere.php index ab7ab9e736..8e2afbb216 100644 --- a/includes/specials/SpecialWhatLinksHere.php +++ b/includes/specials/SpecialWhatLinksHere.php @@ -349,11 +349,11 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { if ( $numRows > $limit ) { // More rows available after these ones // Get the nextId from the last row in the result set - $nextId = $rows[$limit]->page_id; + $nextId = $rows[$limit]->page_id ?? false; // Remove undisplayed rows, for dir='prev' we need to discard first record after sorting $rows = array_slice( $rows, 1, $limit ); // Get the prevId from the first displayed row - $prevId = $rows[0]->page_id; + $prevId = $rows[0]->page_id ?? false; } else { // Get the nextId from the last displayed row $nextId = $rows[$numRows - 1]->page_id; @@ -364,7 +364,7 @@ class SpecialWhatLinksHere extends IncludableSpecialPage { $prevId = $offset ? $rows[0]->page_id : false; if ( $numRows > $limit ) { // Get the nextId from the last displayed row - $nextId = $rows[$limit - 1]->page_id; + $nextId = $rows[$limit - 1]->page_id ?? false; // Remove undisplayed rows $rows = array_slice( $rows, 0, $limit ); } else { -- 2.30.2