jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/371203 )
Change subject: SpecialDoubleRedirects: Fix undefined '$result->namespace' notice ...................................................................... SpecialDoubleRedirects: Fix undefined '$result->namespace' notice Follows-up 7be1a8c0bc4d29d. $result is used for both the original and the on-demand deep query (in case of cache). However this re-query can fail if the page no longer exists. This used to be accounted for by creating the Title object before (possibly) trying to re-query, and also checked for with "if !$result", which is only intended to happen if the re-query failed (the initial value of $result comes from the main (cacheable) query, and always exists. Could be moved by moving the $titleA assignment back up, but that doesn't address the confusion problem that led to this. Fix it by using a separate variable names. Bug: T173045 Change-Id: I0e9ae89a3772b33b916b506033bd334ade5f03fa --- M includes/specials/SpecialDoubleRedirects.php 1 file changed, 25 insertions(+), 20 deletions(-) Approvals: 20after4: Looks good to me, approved jenkins-bot: Verified diff --git a/includes/specials/SpecialDoubleRedirects.php b/includes/specials/SpecialDoubleRedirects.php index ba14c66..d73ac19 100644 --- a/includes/specials/SpecialDoubleRedirects.php +++ b/includes/specials/SpecialDoubleRedirects.php @@ -122,28 +122,33 @@ // That does save the bulk of the query cost, but now we need to // get a little more detail about each individual entry quickly // using the filter of reallyGetQueryInfo. - if ( $result && !isset( $result->b_namespace ) ) { - $dbr = wfGetDB( DB_REPLICA ); - $qi = $this->reallyGetQueryInfo( - $result->namespace, - $result->title - ); - $res = $dbr->select( - $qi['tables'], - $qi['fields'], - $qi['conds'], - __METHOD__ - ); + $deep = false; + if ( $result ) { + if ( isset( $result->b_namespace ) ) { + $deep = $result; + } else { + $dbr = wfGetDB( DB_REPLICA ); + $qi = $this->reallyGetQueryInfo( + $result->namespace, + $result->title + ); + $res = $dbr->select( + $qi['tables'], + $qi['fields'], + $qi['conds'], + __METHOD__ + ); - if ( $res ) { - $result = $dbr->fetchObject( $res ); + if ( $res ) { + $deep = $dbr->fetchObject( $res ) ?: false; + } } } $titleA = Title::makeTitle( $result->namespace, $result->title ); $linkRenderer = $this->getLinkRenderer(); - if ( !$result ) { + if ( !$deep ) { return '<del>' . $linkRenderer->makeLink( $titleA, null, [], [ 'redirect' => 'no' ] ) . '</del>'; } @@ -171,7 +176,7 @@ [ 'redirect' => 'no' ] ); - $titleB = Title::makeTitle( $result->b_namespace, $result->b_title ); + $titleB = Title::makeTitle( $deep->b_namespace, $deep->b_title ); $linkB = $linkRenderer->makeKnownLink( $titleB, null, @@ -180,10 +185,10 @@ ); $titleC = Title::makeTitle( - $result->c_namespace, - $result->c_title, - $result->c_fragment, - $result->c_interwiki + $deep->c_namespace, + $deep->c_title, + $deep->c_fragment, + $deep->c_interwiki ); $linkC = $linkRenderer->makeKnownLink( $titleC, $titleC->getFullText() ); -- To view, visit https://gerrit.wikimedia.org/r/371203 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I0e9ae89a3772b33b916b506033bd334ade5f03fa Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/core Gerrit-Branch: wmf/1.30.0-wmf.13 Gerrit-Owner: 20after4 <mmod...@wikimedia.org> Gerrit-Reviewer: 20after4 <mmod...@wikimedia.org> Gerrit-Reviewer: Florianschmidtwelzow <florian.schmidt.stargatewis...@gmail.com> Gerrit-Reviewer: Krinkle <krinklem...@gmail.com> Gerrit-Reviewer: jenkins-bot <> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits