"Dantman" posted a comment on MediaWiki.r104688.
URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/104688#c27209

Commit summary for MediaWiki.r104688:

Followup r104274, r104676. Fix the bug that broke fr. Forgot to rawurldecode 
path contents.
Also add /u just for sanity sake.
Add new tests for url encoding, unicode, and length edge cases.

Dantman's comment:

The $1 is there since there is no value in having a 'title' => '$1' when the 
path doesn't contain $1.

In fact, doing so (adding a $1 when the path has no $1) would cause the entire 
rule to be ignored because $1 has no matched data, even though the user didn't 
ask for the $1 to be added to the paramters. As a result if that $1 check 
wasn't there <code>$router->addStrict( '/somepath/Bar', array( 'curid' => 45875 
);</code> would have a 'title' => '$1' added to it, and the author would be 
left in blind confusion as their entire rule is completely ignored by the 
routing code because it will never have a value for $1 to put into 'title'.

makeWeight could probably be fixed to be protected. I might have been using it 
outside of the class when actually implementing it to test it and make sure it 
was working right. Or considered using it directly in tests to make sure it 
always weighted things correctly.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to