From ec7101610c90d12772aa52c1a09ddee72bcea806 Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Tue, 12 Jul 2011 20:55:05 +0000 Subject: [PATCH] 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! --- includes/parser/Parser.php | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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 -- 2.20.1