replaceSection() should replace entire content if the section id is the empty string.
[lhc/web/wiklou.git] / includes / Content.php
index 793e62b..41b7ac3 100644 (file)
@@ -541,7 +541,9 @@ class WikitextContent extends TextContent {
                $oldtext = $this->getNativeData();
                $text = $with->getNativeData();
 
-               if ( $section == 'new' ) {
+               if ( $section === '' ) {
+                       return $with; #XXX: copy first?
+               } if ( $section == 'new' ) {
                        # Inserting a new section
                        $subject = $sectionTitle ? wfMsgForContent( 'newsectionheaderdefaultlevel', $sectionTitle ) . "\n\n" : '';
                        if ( wfRunHooks( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) {