Index: trunk/phase3/maintenance/parserTests.txt |
— | — | @@ -5444,6 +5444,16 @@ |
5445 | 5445 | a |
5446 | 5446 | !! end |
5447 | 5447 | |
| 5448 | +!! test |
| 5449 | +Handling of 
 in URLs |
| 5450 | +!! input |
| 5451 | +**irc://
a |
| 5452 | +!! result |
| 5453 | +<ul><li><ul><li><a href="irc://%0Aa" class="external free" title="irc://%0Aa" rel="nofollow">irc://%0Aa</a> |
| 5454 | +</li></ul> |
| 5455 | +</li></ul> |
| 5456 | + |
| 5457 | +!!end |
5448 | 5458 | # |
5449 | 5459 | # |
5450 | 5460 | # |
Index: trunk/phase3/includes/Parser.php |
— | — | @@ -1145,6 +1145,9 @@ |
1146 | 1146 | # Normalize any HTML entities in input. They will be |
1147 | 1147 | # re-escaped by makeExternalLink(). |
1148 | 1148 | $url = Sanitizer::decodeCharReferences( $url ); |
| 1149 | + |
| 1150 | + # Escape any control characters introduced by the above step |
| 1151 | + $url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url ); |
1149 | 1152 | |
1150 | 1153 | # Process the trail (i.e. everything after this link up until start of the next link), |
1151 | 1154 | # replacing any non-bracketed links |
— | — | @@ -1228,6 +1231,9 @@ |
1229 | 1232 | # Normalize any HTML entities in input. They will be |
1230 | 1233 | # re-escaped by makeExternalLink() or maybeMakeExternalImage() |
1231 | 1234 | $url = Sanitizer::decodeCharReferences( $url ); |
| 1235 | + |
| 1236 | + # Escape any control characters introduced by the above step |
| 1237 | + $url = preg_replace( '/[\][<>"\\x00-\\x20\\x7F]/e', "urlencode('\\0')", $url ); |
1232 | 1238 | |
1233 | 1239 | # Is this an external image? |
1234 | 1240 | $text = $this->maybeMakeExternalImage( $url ); |
— | — | @@ -1536,6 +1542,7 @@ |
1537 | 1543 | $sortkey = $text; |
1538 | 1544 | } |
1539 | 1545 | $sortkey = Sanitizer::decodeCharReferences( $sortkey ); |
| 1546 | + $sortkey = str_replace( "\n", '', $sortkey ); |
1540 | 1547 | $sortkey = $wgContLang->convertCategoryKey( $sortkey ); |
1541 | 1548 | $this->mOutput->addCategory( $nt->getDBkey(), $sortkey ); |
1542 | 1549 | |