$dbkey = preg_replace( '/[ _\xA0\x{1680}\x{180E}\x{2000}-\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}]+/u', '_', $dbkey );
$dbkey = trim( $dbkey, '_' );
- if ( $dbkey == '' ) {
- return false;
- }
-
if ( strpos( $dbkey, UTF8_REPLACEMENT ) !== false ) {
# Contained illegal UTF-8 sequences or forbidden Unicode chars.
return false;
# Initial colon indicates main namespace rather than specified default
# but should not create invalid {ns,title} pairs such as {0,Project:Foo}
- if ( ':' == $dbkey[0] ) {
+ if ( $dbkey !== '' && ':' == $dbkey[0] ) {
$this->mNamespace = NS_MAIN;
$dbkey = substr( $dbkey, 1 ); # remove the colon but continue processing
$dbkey = trim( $dbkey, '_' ); # remove any subsequent whitespace
}
+ if ( $dbkey == '' ) {
+ return false;
+ }
+
# Namespace or interwiki prefix
$firstPass = true;
$prefixRegexp = "/^(.+?)_*:_*(.*)$/S";
// Trim underscores
.replace( rUnderscoreTrim, '' );
- if ( title === '' ) {
- return false;
- }
-
// Process initial colon
- if ( title.charAt( 0 ) === ':' ) {
+ if ( title !== '' && title.charAt( 0 ) === ':' ) {
// Initial colon means main namespace instead of specified default
namespace = NS_MAIN;
title = title
.replace( rUnderscoreTrim, '' );
}
+ if ( title === '' ) {
+ return false;
+ }
+
// Process namespace prefix (if any)
m = title.match( rSplit );
if ( m ) {