*/
public function formatTitle( $namespace, $text, $fragment = '', $interwiki = '' ) {
if ( $namespace !== false ) {
- $namespace = $this->getNamespaceName( $namespace, $text );
+ // Try to get a namespace name, but fallback
+ // to empty string if it doesn't exist
+ try {
+ $nsName = $this->getNamespaceName( $namespace, $text );
+ } catch ( InvalidArgumentException $e ) {
+ $nsName = '';
+ }
- if ( $namespace !== '' ) {
- $text = $namespace . ':' . $text;
+ if ( $namespace !== 0 ) {
+ $text = $nsName . ':' . $text;
}
}
// getGenderCache() provides a mock that considers first
// names ending in "a" to be female.
[ NS_USER, 'Lisa_Müller', '', 'de', 'Benutzerin:Lisa Müller' ],
+ [ 1000000, 'Invalid_namespace', '', 'en', ':Invalid namespace' ],
];
}