Index: trunk/phase3/includes/parser/Parser.php |
— | — | @@ -4315,6 +4315,7 @@ |
4316 | 4316 | */ |
4317 | 4317 | public function setHook( $tag, $callback ) { |
4318 | 4318 | $tag = strtolower( $tag ); |
| 4319 | + if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); |
4319 | 4320 | $oldVal = isset( $this->mTagHooks[$tag] ) ? $this->mTagHooks[$tag] : null; |
4320 | 4321 | $this->mTagHooks[$tag] = $callback; |
4321 | 4322 | if ( !in_array( $tag, $this->mStripList ) ) { |
— | — | @@ -4326,6 +4327,7 @@ |
4327 | 4328 | |
4328 | 4329 | function setTransparentTagHook( $tag, $callback ) { |
4329 | 4330 | $tag = strtolower( $tag ); |
| 4331 | + if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); |
4330 | 4332 | $oldVal = isset( $this->mTransparentTagHooks[$tag] ) ? $this->mTransparentTagHooks[$tag] : null; |
4331 | 4333 | $this->mTransparentTagHooks[$tag] = $callback; |
4332 | 4334 | |
— | — | @@ -4430,6 +4432,7 @@ |
4431 | 4433 | */ |
4432 | 4434 | function setFunctionTagHook( $tag, $callback, $flags ) { |
4433 | 4435 | $tag = strtolower( $tag ); |
| 4436 | + if ( preg_match( '/[<> \r\n]/', $tag, $m ) ) throw new MWException( "Invalid character {$m[0]} in setHook('$tag', ...) call" ); |
4434 | 4437 | $old = isset( $this->mFunctionTagHooks[$tag] ) ? |
4435 | 4438 | $this->mFunctionTagHooks[$tag] : null; |
4436 | 4439 | $this->mFunctionTagHooks[$tag] = array( $callback, $flags ); |