action=edit API with section=new would fail if page didn't exist
authorKunal Mehta <legoktm@gmail.com>
Wed, 14 Aug 2013 03:34:48 +0000 (20:34 -0700)
committerKunal Mehta <legoktm@gmail.com>
Wed, 14 Aug 2013 21:40:31 +0000 (14:40 -0700)
If the page doesn't exist, $articleObject->replaceSectionContent will return null
Fixes a regression introduced in be97167ab61e7d59d86f6a9dca53b7016d615735.

Bug: 52830
Change-Id: Icdc0f130eeb40fff5c656c396b2a2af294015b98

includes/api/ApiEditPage.php

index 9c079da..d14219f 100644 (file)
@@ -329,7 +329,7 @@ class ApiEditPage extends ApiBase {
 
                // The following is needed to give the hook the full content of the
                // new revision rather than just the current section. (Bug 52077)
-               if ( !is_null( $params['section'] ) && $contentHandler->supportsSections() ) {
+               if ( !is_null( $params['section'] ) && $contentHandler->supportsSections() && $titleObj->exists() ) {
 
                        $sectionTitle = '';
                        // If sectiontitle is set, use it, otherwise use the summary as the section title (for