Page MenuHomePhabricator

WikiPage::isRedirect and WikiPage::getRedirectTarget() seemingly disagree
Open, MediumPublic


Follows T226592: Fatal error from CirrusSearch/IncomingLinkCount Job: Argument to WikiPage::__construct must be Title.

The patch resulted in the following code:

			if ( $page->isRedirect() ) {
				$target = $page->getRedirectTarget();
				if ( $target === null ) {
					// Redirect to itself or broken redirect? ignore.

I was just wondering whether this is part of WikiPage is working as intended, and whether a check like this is intended to be needed for use of this kind, or whether perhaps it is meant to be used differently for this use case.

For example:

  • Should these two methods always agree?
  • Is there a use case for the current logic of WikiPage::isRedirect() which is effectively a copy of Title::isRedirect(), without covering the existence and validity of an "ultimate" redirect target?
  • Maybe isRedirect just need some documentation to discourage and clarify its purpose, and generally recommend directly using getRedirectTarget instead and only that method, given it already checks isRedirect first internally as optimisation.

Feel free to close if there is no action to be taken.

Event Timeline

WDoranWMF triaged this task as Medium priority.Jul 2 2019, 6:55 PM
WDoranWMF removed a project: Platform Engineering.
Aklapper changed the task status from Stalled to Open.Oct 19 2020, 4:31 PM

The previous comments don't explain who or what (task?) exactly this task is stalled on ("If a report is waiting for further input (e.g. from its reporter or a third party) and can currently not be acted on"). Hence resetting task status.

(Smallprint, as general orientation for task management: If you wanted to express that nobody is currently working on this task, then the assignee should be removed and/or priority could be lowered instead. If work on this task is blocked by another task, then that other task should be added via Edit Related Tasks...Edit Subtasks. If this task is stalled on an upstream project, then the Upstream tag should be added. If this task requires info from the task reporter, then there should be instructions which info is needed. If this task needs retesting, then the TestMe tag should be added. If this task is either out of scope and nobody should ever work on this, or nobody else managed to reproduce the problem described in this task, then this task should have the "Declined" status. If the task is valid but should not appear on some team's workboard, then the team project tag should be removed while the task has another active project tag.)