Check for namespace existence in Title::makeTitleSafe().
Namespace existence has to be checked before calling Title::makeName() because otherwise it will fallback to a page with the same name, but in the main namespace which is not what we want here. Change-Id: I8c087390044c54dd0502c1b8bb9321dfaec6b5f7
This commit is contained in:
parent
edfb4c738c
commit
9eb25dc032
1 changed files with 4 additions and 0 deletions
|
|
@ -317,6 +317,10 @@ class Title {
|
|||
* @return Title the new object, or NULL on an error
|
||||
*/
|
||||
public static function makeTitleSafe( $ns, $title, $fragment = '', $interwiki = '' ) {
|
||||
if ( !MWNamespace::exists( $ns ) ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
$t = new Title();
|
||||
$t->mDbkeyform = Title::makeName( $ns, $title, $fragment, $interwiki );
|
||||
if ( $t->secureAndSplit() ) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue