r80065 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r80064‎ | r80065 | r80066 >
Date:00:11, 12 January 2011
Author:platonides
Status:ok
Tags:
Comment:
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().
Modified paths:
  • /trunk/phase3/includes/parser/Parser.php (modified) (history)
  • /trunk/phase3/tests/phpunit/includes/parser/TagHooks.php (modified) (history)

Diff [purge]

Index: trunk/phase3/tests/phpunit/includes/parser/TagHooks.php
@@ -6,11 +6,11 @@
77 class TagHookTest extends MediaWikiTestCase {
88
99 public static function provideValidNames() {
10 - return array( array( 'foo' ), array( 'foo-bar' ), array( 'foo_bar' ), array( 'FOO-BAR' ) );
 10+ return array( array( 'foo' ), array( 'foo-bar' ), array( 'foo_bar' ), array( 'FOO-BAR' ), array( 'foo bar' ) );
1111 }
1212
1313 public static function provideBadNames() {
14 - return array( array( "foo<bar" ), array( "foo>bar" ), array( "foo bar" ), array( "foo\nbar" ), array( "foo\rbar" ) );
 14+ return array( array( "foo<bar" ), array( "foo>bar" ), array( "foo\nbar" ), array( "foo\rbar" ) );
1515 }
1616
1717 /**
Index: trunk/phase3/includes/parser/Parser.php
@@ -4315,7 +4315,7 @@
43164316 */
43174317 public function setHook( $tag, $callback ) {
43184318 $tag = strtolower( $tag );
4319 - if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
 4319+ if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
43204320 $oldVal = isset( $this->mTagHooks[$tag] ) ? $this->mTagHooks[$tag] : null;
43214321 $this->mTagHooks[$tag] = $callback;
43224322 if ( !in_array( $tag, $this->mStripList ) ) {
@@ -4327,7 +4327,7 @@
43284328
43294329 function setTransparentTagHook( $tag, $callback ) {
43304330 $tag = strtolower( $tag );
4331 - if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
 4331+ if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
43324332 $oldVal = isset( $this->mTransparentTagHooks[$tag] ) ? $this->mTransparentTagHooks[$tag] : null;
43334333 $this->mTransparentTagHooks[$tag] = $callback;
43344334
@@ -4432,7 +4432,7 @@
44334433 */
44344434 function setFunctionTagHook( $tag, $callback, $flags ) {
44354435 $tag = strtolower( $tag );
4436 - if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
 4436+ if ( preg_match( '/[<>\r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" );
44374437 $old = isset( $this->mFunctionTagHooks[$tag] ) ?
44384438 $this->mFunctionTagHooks[$tag] : null;
44394439 $this->mFunctionTagHooks[$tag] = array( $callback, $flags );

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r80025Forbid '<', '>', ' ', '\n', '\r' in parser hook names....platonides18:38, 11 January 2011

Status & tagging log