Fix bug 13253: <NOINCLUDE>foo</NOINCLUDE> causes exception
authorTim Starling <tstarling@users.mediawiki.org>
Wed, 5 Mar 2008 01:07:47 +0000 (01:07 +0000)
committerTim Starling <tstarling@users.mediawiki.org>
Wed, 5 Mar 2008 01:07:47 +0000 (01:07 +0000)
includes/Preprocessor_DOM.php
includes/Preprocessor_Hash.php

index 0e2e9a1..f476b95 100644 (file)
@@ -267,6 +267,7 @@ class Preprocessor_DOM implements Preprocessor {
                                        continue;
                                }
                                $name = $matches[1];
+                               $lowerName = strtolower( $name );
                                $attrStart = $i + strlen( $name ) + 1;
 
                                // Find end of tag
@@ -281,7 +282,7 @@ class Preprocessor_DOM implements Preprocessor {
                                }
 
                                // Handle ignored tags
-                               if ( in_array( $name, $ignoredTags ) ) {
+                               if ( in_array( $lowerName, $ignoredTags ) ) {
                                        $accum .= '<ignore>' . htmlspecialchars( substr( $text, $i, $tagEndPos - $i + 1 ) ) . '</ignore>';
                                        $i = $tagEndPos + 1;
                                        continue;
@@ -308,7 +309,7 @@ class Preprocessor_DOM implements Preprocessor {
                                        }
                                }
                                // <includeonly> and <noinclude> just become <ignore> tags
-                               if ( in_array( $name, $ignoredElements ) ) {
+                               if ( in_array( $lowerName, $ignoredElements ) ) {
                                        $accum .= '<ignore>' . htmlspecialchars( substr( $text, $tagStartPos, $i - $tagStartPos ) ) 
                                                . '</ignore>';
                                        continue;
index 2034278..64ed8eb 100644 (file)
@@ -254,6 +254,7 @@ class Preprocessor_Hash implements Preprocessor {
                                        continue;
                                }
                                $name = $matches[1];
+                               $lowerName = strtolower( $name );
                                $attrStart = $i + strlen( $name ) + 1;
 
                                // Find end of tag
@@ -268,7 +269,7 @@ class Preprocessor_Hash implements Preprocessor {
                                }
 
                                // Handle ignored tags
-                               if ( in_array( $name, $ignoredTags ) ) {
+                               if ( in_array( $lowerName, $ignoredTags ) ) {
                                        $accum->addNodeWithText( 'ignore', substr( $text, $i, $tagEndPos - $i + 1 ) );
                                        $i = $tagEndPos + 1;
                                        continue;
@@ -296,7 +297,7 @@ class Preprocessor_Hash implements Preprocessor {
                                        }
                                }
                                // <includeonly> and <noinclude> just become <ignore> tags
-                               if ( in_array( $name, $ignoredElements ) ) {
+                               if ( in_array( $lowerName, $ignoredElements ) ) {
                                        $accum->addNodeWithText(  'ignore', substr( $text, $tagStartPos, $i - $tagStartPos ) );
                                        continue;
                                }