From: Platonides Date: Wed, 12 Jan 2011 00:11:11 +0000 (+0000) Subject: Follow up r80025. X-Git-Tag: 1.31.0-rc.0~32610 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=5ceb97cfc39970a26d4fdbe09dfbef3e36a74df2;p=lhc%2Fweb%2Fwiklou.git Follow up r80025. The space is actually used inside extensions, such as Maps, covertly called as 'display_map' into Validator, then converted into 'display map' by getName(). --- diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index 3d37703499..a14255b6d3 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -4315,7 +4315,7 @@ class Parser { */ public function setHook( $tag, $callback ) { $tag = strtolower( $tag ); - if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); + if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); $oldVal = isset( $this->mTagHooks[$tag] ) ? $this->mTagHooks[$tag] : null; $this->mTagHooks[$tag] = $callback; if ( !in_array( $tag, $this->mStripList ) ) { @@ -4327,7 +4327,7 @@ class Parser { function setTransparentTagHook( $tag, $callback ) { $tag = strtolower( $tag ); - if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); + if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); $oldVal = isset( $this->mTransparentTagHooks[$tag] ) ? $this->mTransparentTagHooks[$tag] : null; $this->mTransparentTagHooks[$tag] = $callback; @@ -4432,7 +4432,7 @@ class Parser { */ function setFunctionTagHook( $tag, $callback, $flags ) { $tag = strtolower( $tag ); - if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); + if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); $old = isset( $this->mFunctionTagHooks[$tag] ) ? $this->mFunctionTagHooks[$tag] : null; $this->mFunctionTagHooks[$tag] = array( $callback, $flags ); diff --git a/tests/phpunit/includes/parser/TagHooks.php b/tests/phpunit/includes/parser/TagHooks.php index 2227908900..f6050728f8 100644 --- a/tests/phpunit/includes/parser/TagHooks.php +++ b/tests/phpunit/includes/parser/TagHooks.php @@ -6,11 +6,11 @@ class TagHookTest extends MediaWikiTestCase { public static function provideValidNames() { - return array( array( 'foo' ), array( 'foo-bar' ), array( 'foo_bar' ), array( 'FOO-BAR' ) ); + return array( array( 'foo' ), array( 'foo-bar' ), array( 'foo_bar' ), array( 'FOO-BAR' ), array( 'foo bar' ) ); } public static function provideBadNames() { - return array( array( "foobar" ), array( "foo bar" ), array( "foo\nbar" ), array( "foo\rbar" ) ); + return array( array( "foobar" ), array( "foo\nbar" ), array( "foo\rbar" ) ); } /**