* (bug 32617) Fix for edit summary on section 0 containing a bogus section heading
authorBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Dec 2011 23:40:44 +0000 (23:40 +0000)
committerBrion Vibber <brion@users.mediawiki.org>
Tue, 6 Dec 2011 23:40:44 +0000 (23:40 +0000)
Based on patch posted by Dan Collins: https://bugzilla.wikimedia.org/attachment.cgi?id=9552
with a tweak to avoid breaking a similar case in other sections. Follows up on function extraction & test cases added in r105379.

includes/EditPage.php

index f403119..b7deb82 100644 (file)
@@ -1720,7 +1720,7 @@ HTML
         * @return Mixed|string or false
         */
        public static function extractSectionTitle( $text ) {
-               preg_match( "/^(=+)(.+)\\1/mi", $text, $matches );
+               preg_match( "/^(=+)(.+)\\1(\n|$)/i", $text, $matches );
                if ( !empty( $matches[2] ) ) {
                        global $wgParser;
                        return $wgParser->stripSectionName(trim($matches[2]));