* Increase robustness of parser placeholders; fixes some glitches when adjacent to...
authorBrion Vibber <brion@users.mediawiki.org>
Fri, 26 May 2006 12:11:54 +0000 (12:11 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Fri, 26 May 2006 12:11:54 +0000 (12:11 +0000)
* Shut up the parser test whining about files in a temp directory.

RELEASE-NOTES
includes/Parser.php
maintenance/parserTests.inc
maintenance/parserTests.txt

index 403c599..75dbe12 100644 (file)
@@ -343,6 +343,9 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
 * Failed, but not zero-length, thumbnail renderings are now removed.
   Should help clean up when rsvg fails in weird ways.
 * (bug 6081) Change description for Turkmen language
+* Increase robustness of parser placeholders; fixes some glitches when
+  adjacent to identifier-ish constructs such as URLs.
+* Shut up the parser test whining about files in a temp directory.
 
 == Compatibility ==
 
index 549ba30..7d4b1f8 100644 (file)
@@ -151,7 +151,15 @@ class Parser
                        'titles' => array()
                );
                $this->mRevisionId = null;
-               $this->mUniqPrefix = 'UNIQ' . Parser::getRandomString();
+               
+               /**
+                * Prefix for temporary replacement strings for the multipass parser.
+                * \x07 should never appear in input as it's disallowed in XML.
+                * Using it at the front also gives us a little extra robustness
+                * since it shouldn't match when butted up against identifier-like
+                * string constructs.
+                */
+               $this->mUniqPrefix = "\x07UNIQ" . Parser::getRandomString();
 
                # Clear these on every parse, bug 4549
                $this->mTemplates = array();
index 0948eed..77d601a 100644 (file)
@@ -520,7 +520,7 @@ class ParserTest {
                @rmdir( "$dir/thumb/3/39" ); # wtf?
                @rmdir( "$dir/thumb/3" );
                @rmdir( "$dir/thumb" );
-               rmdir( "$dir" );
+               @rmdir( "$dir" );
        }
 
        /**
index f2fa9c2..234c5f4 100644 (file)
@@ -4115,6 +4115,36 @@ blah" onmouseover="alert('hello world');" align="left"<b>MOVE MOUSE CURSOR OVER
 
 !! end
 
+!!test
+Fuzz testing: URL adjacent extension (with space, clean)
+!! options
+!! input
+http://example.com <nowiki>junk</nowiki>
+!! result
+<p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a> junk
+</p>
+!!end
+
+!!test
+Fuzz testing: URL adjacent extension (no space, dirty; nowiki)
+!! options
+!! input
+http://example.com<nowiki>junk</nowiki>
+!! result
+<p><a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a>junk
+</p>
+!!end
+
+!!test
+Fuzz testing: URL adjacent extension (no space, dirty; pre)
+!! options
+!! input
+http://example.com<pre>junk</pre>
+!! result
+<a href="http://example.com" class='external free' title="http://example.com" rel="nofollow">http://example.com</a><pre>junk</pre>
+
+!!end
+
 #
 #
 #