has a % sign in it, but interperted as a + if no % sign is present.
This changes how the parser interperts links slightly. However:
*I can't imagine anyone is relying on this behaviour
*Things should be consistent. a + sign shouldn't magically change meaning
if there is a % sign somewhere else in the link.
*Pages are allowed to contain % signs in their title, and + signs,
you should be able to link to such pages just by typing there name without
resorting to %2B.
*If you have a page named foo%+ having [[{{PAGENAME}}]] link to a different
page seems inherently wrong.
*The previous behaviour seemed accidental.
* (bug 18372) File types blacklisted by $wgFileBlacklist will no longer be shown as
"Permitted file types" on the upload form
* (bug 26379) importImages.php gives more descriptive error message on failure.
+* (Bug 26410) + signs are no longer treated as spaces in internal links if
+ link has a % sign in it.
=== API changes in 1.18 ===
* (bug 26339) Throw warning when truncating an overlarge API result
# fix up urlencoded title texts (copied from Parser::replaceInternalLinks)
if ( strpos( $match[1], '%' ) !== false ) {
- $match[1] = str_replace( array( '<', '>' ), array( '<', '>' ), urldecode( $match[1] ) );
+ $match[1] = str_replace( array( '<', '>' ), array( '<', '>' ), rawurldecode( $match[1] ) );
}
# Handle link renaming [[foo|text]] will show link as "text"
// and URL-decode links
if ( strpos( $m[1], '%' ) !== false ) {
// Match behavior of inline link parsing here;
- // don't interpret + as " " most of the time!
- // It might be safe to just use rawurldecode instead, though.
- $m[1] = urldecode( ltrim( $m[1], ':' ) );
+ $m[1] = rawurldecode( ltrim( $m[1], ':' ) );
}
$title = Title::newFromText( $m[1] );
// If the title is a redirect to bad special pages or is invalid, return null
# fix up urlencoded title texts
if ( strpos( $m[1], '%' ) !== false ) {
# Should anchors '#' also be rejected?
- $m[1] = str_replace( array('<', '>'), array('<', '>'), urldecode( $m[1] ) );
+ $m[1] = str_replace( array('<', '>'), array('<', '>'), rawurldecode( $m[1] ) );
}
$trail = $m[3];
} elseif ( preg_match( $e1_img, $line, $m ) ) { # Invalid, but might be an image with a link in its caption
$might_be_img = true;
$text = $m[2];
if ( strpos( $m[1], '%' ) !== false ) {
- $m[1] = urldecode( $m[1] );
+ $m[1] = rawurldecode( $m[1] );
}
$trail = "";
} else { # Invalid form; output directly
}
if ( strpos( $matches[0], '%' ) !== false ) {
- $matches[1] = urldecode( $matches[1] );
+ $matches[1] = rawurldecode( $matches[1] );
}
$tp = Title::newFromText( $matches[1] );
$nt =& $tp;