Page MenuHomePhabricator

Query pages do not handle invalid titles properly
Closed, ResolvedPublic

Description

The results of special:Disambiguations for enwiki, last updated 2008-09-07T06:21:55 contain an invalid title at result #472, causing a PHP fatal error:

PHP fatal error in /usr/local/apache/common-local/php-1.5/includes/Linker.php line 461:
Argument 1 passed to Linker::makeKnownLinkObj() must be an instance of Title, null given, called in /usr/local/apache/common-local/php-1.5/includes/specials/SpecialDisambiguations.php on line 90 and defined


Version: unspecified
Severity: normal
URL: http://en.wikipedia.org/w/index.php?title=Special:Disambiguations&limit=471&offset=1

Details

Reference
bz15528

Event Timeline

bzimport raised the priority of this task from to Medium.Nov 21 2014, 10:24 PM
bzimport set Reference to bz15528.

It looks like the article got deleted:

select * from querycache where qc_type='Disambiguations' limit 1 OFFSET 471;

+-----------------+----------+--------------+-------------+

qc_typeqc_valueqc_namespaceqc_title

+-----------------+----------+--------------+-------------+

Disambiguations27383900Proprietary

+-----------------+----------+--------------+-------------+
1 row in set (0.00 sec)

select page_namespace,page_title from page where page_id='2738390';

Empty set (0.00 sec)

Not going to run a query on archive ar_page_id since there is no index.

Quoting MinuteElectron on IRC :
"What is happening here is that the title object is not being check for being null before being used."

Indeed :

SpecialDisambiguations.php :

function formatResult( $skin, $result ) {

global $wgContLang;
$title = Title::newFromId( $result->value );
$dp = Title::makeTitle( $result->namespace, $result->title );

Next line trigger the error. The article got deleted and we did not check
we had a valid title :)

$from = $skin->makeKnownLinkObj( $title, '' );

r40496 should prevent the fatal error in Linker.php, just not yet live on Wikimedia yet. Marking as resolved.

Code still need to be patched to use linker::link()
Various special pages are still using the old functions.

r40622 fix:

  • Special:Disambiguations
  • Special:Mostcategories
  • SpecialMostlinkedtemplates

Still need to fix the other ones such as Special:Shortpages