r61611 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r61610‎ | r61611 | r61612 >
Date:22:52, 27 January 2010
Author:platonides
Status:ok (Comments)
Tags:
Comment:
Follow-up r61581. As P.Copp has pointed out, \b and \B don't work inside character classes.
Modified paths:
  • /trunk/extensions/CodeReview/backend/CodeCommentLinker.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CodeReview/backend/CodeCommentLinker.php
@@ -11,7 +11,7 @@
1212 function link( $text ) {
1313 # Catch links like http://www.mediawiki.org/wiki/Special:Code/MediaWiki/44245#c829
1414 # Ended by space or brackets (like those pesky <br /> tags)
15 - $text = preg_replace_callback( '/([^\B[])(' . wfUrlProtocols() . ')([^ <>]+)(\b)/', array( $this, 'generalLink' ), $text );
 15+ $text = preg_replace_callback( '/(^|[^\w[])(' . wfUrlProtocols() . ')([^ <>]+)(\b)/', array( $this, 'generalLink' ), $text );
1616 $text = preg_replace_callback( '/\br(\d+)\b/', array( $this, 'messageRevLink' ), $text );
1717 $text = preg_replace_callback( '/\bbug #?(\d+)\b/i', array( $this, 'messageBugLink' ), $text );
1818 return $text;

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r61581Do not catch urls which begin with a bracket like [http://example.com this] /...platonides17:15, 27 January 2010

Comments

#Comment by Tim Starling (talk | contribs)   02:51, 29 January 2010

Did you test this?

#Comment by Platonides (talk | contribs)   14:33, 29 January 2010

Yes, I tested the preg_replace_callback output with both [] urls and invalid protocols (on r61581 I had only checked that the bug wasn't there).

Status & tagging log