From: Tim Starling Date: Sat, 7 Aug 2004 18:45:30 +0000 (+0000) Subject: Fixing bug #584804, extra characters requested in $sep for external links. This inclu... X-Git-Tag: 1.5.0alpha1~2478 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/password.php?a=commitdiff_plain;h=5d58e45c1a9ec405151041897f4369c7c56bed61;p=lhc%2Fweb%2Fwiklou.git Fixing bug #584804, extra characters requested in $sep for external links. This includes the right parenthesis fix suggested by Brion. --- diff --git a/includes/Parser.php b/includes/Parser.php index d6c7c222bc..b2573e04ae 100644 --- a/includes/Parser.php +++ b/includes/Parser.php @@ -1149,9 +1149,6 @@ class Parser $s = array_shift( $bits ); $i = 0; - # Characters which may occur in the middle of a URL, but not at the end - $sep = ",;\.:"; - $sk =& $this->mOptions->getSkin(); while ( $i < count( $bits ) ){ @@ -1163,7 +1160,13 @@ class Parser $url = $protocol . $m[1]; $trail = $m[2]; - # Move characters in $sep to $trail + # Move trailing punctuation to $trail + $sep = ',;\.:!?'; + # If there is no left bracket, then consider right brackets fair game too + if ( strpos( $url, '(' ) === false ) { + $sep .= ')'; + } + $numSepChars = strspn( strrev( $url ), $sep ); if ( $numSepChars ) { $trail = substr( $url, -$numSepChars ) . $trail;