Merge "API: Check for nosuchsection in all code paths"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Tue, 24 Sep 2013 22:46:01 +0000 (22:46 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Tue, 24 Sep 2013 22:46:01 +0000 (22:46 +0000)
RELEASE-NOTES-1.22
includes/api/ApiEditPage.php

index 4fb948a..957ee64 100644 (file)
@@ -370,6 +370,8 @@ production.
 * (bug 49090) Token-getting functions will fail when using jsonp callbacks.
 * (bug 52699) action=upload returns normalized file name on warning
   "exists-normalized" instead of filename to be uploaded to.
+* (bug 53884) action=edit will now return an error when the specified section
+  does not exist in the page.
 
 === Languages updated in 1.22===
 
index d14219f..bd61895 100644 (file)
@@ -280,6 +280,10 @@ class ApiEditPage extends ApiBase {
                        if ( $section == 0 && $params['section'] != '0' && $params['section'] != 'new' ) {
                                $this->dieUsage( "The section parameter must be set to an integer or 'new'", "invalidsection" );
                        }
+                       $content = $pageObj->getContent();
+                       if ( $section !== 0 && ( !$content || !$content->getSection( $section ) ) ) {
+                               $this->dieUsage( "There is no section {$section}.", 'nosuchsection' );
+                       }
                        $requestArray['wpSection'] = $params['section'];
                } else {
                        $requestArray['wpSection'] = '';