If the title for a 'title' or 'title-link' type is invalid, the code
still must not return a non-array from the method.
I'm not sure this is what was behind T176938, but it's the only thing I
can find that might cause the errors I saw logged at about the same
time.
Change-Id: Iae77eb6ad9a64d8b67074164ff0c0fea36826f3c
case 'title':
case 'title-link':
$title = Title::newFromText( $value );
- if ( $title ) {
- $value = [];
- ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
+ if ( !$title ) {
+ // Huh? Do something halfway sane.
+ $title = SpecialPage::getTitleFor( 'Badtitle', $value );
}
+ $value = [];
+ ApiQueryBase::addTitleInfo( $value, $title, "{$name}_" );
return $value;
case 'user':
'key_ns' => NS_PROJECT,
'key_title' => Title::newFromText( 'project:foo' )->getFullText(),
] ],
+ [ '4:title-link:key', '<invalid>', [
+ 'key_ns' => NS_SPECIAL,
+ 'key_title' => SpecialPage::getTitleFor( 'Badtitle', '<invalid>' )->getFullText(),
+ ] ],
[ '4:user:key', 'foo', [ 'key' => 'Foo' ] ],
[ '4:user-link:key', 'foo', [ 'key' => 'Foo' ] ],
];