From: Roan Kattouw Date: Tue, 12 Jul 2011 20:55:05 +0000 (+0000) Subject: Fix r14202 (!!): this validates the protocol against the regex for the second time... X-Git-Tag: 1.31.0-rc.0~28896 X-Git-Url: http://git.cyclocoop.org/%28?a=commitdiff_plain;h=ec7101610c90d12772aa52c1a09ddee72bcea806;p=lhc%2Fweb%2Fwiklou.git Fix r14202 (!!): this validates the protocol against the regex for the second time (preg_split has already made sure it matches wfUrlProtocols() so no need), and uses strpos() to validate against a regex (that's just wrong). I'm removing it not because it's useless but because it breaks for URL protocols that don't contain a ':' ('//' in my case) for no reason at all. Found out about this when writing parser tests for it (will commit these in a minute), so yay tests! --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 6cf9bbc076..914afa8479 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -1540,16 +1540,10 @@ class Parser { # No link text, e.g. [http://domain.tld/some.link] if ( $text == '' ) { - # Autonumber if allowed. See bug #5918 - if ( strpos( wfUrlProtocols(), substr( $protocol, 0, strpos( $protocol, ':' ) ) ) !== false ) { - $langObj = $this->getFunctionLang(); - $text = '[' . $langObj->formatNum( ++$this->mAutonumber ) . ']'; - $linktype = 'autonumber'; - } else { - # Otherwise just use the URL - $text = htmlspecialchars( $url ); - $linktype = 'free'; - } + # Autonumber + $langObj = $this->getFunctionLang(); + $text = '[' . $langObj->formatNum( ++$this->mAutonumber ) . ']'; + $linktype = 'autonumber'; } else { # Have link text, e.g. [http://domain.tld/some.link text]s # Check for trail