From: Roan Kattouw Date: Tue, 24 Mar 2009 16:15:43 +0000 (+0000) Subject: API: (bug 18099) Editing a non-existent page with appendtext caused the contents... X-Git-Tag: 1.31.0-rc.0~42389 X-Git-Url: https://git.cyclocoop.org/%7B%24admin_url%7Dmembres/modifier.php?a=commitdiff_plain;h=ac81ec65139a3b51f66f0a7b1536266b024ebf26;p=lhc%2Fweb%2Fwiklou.git API: (bug 18099) Editing a non-existent page with appendtext caused the contents of the noarticletext(anon) message to appear in the page text --- diff --git a/RELEASE-NOTES b/RELEASE-NOTES index af7abc3062..7a6f6fcdac 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -331,6 +331,8 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN * BREAKING CHANGE: action=purge requires write rights and, for anonymous users, a POST request * (bug 15935) Added action=userrights to add/remove users to/from groups +* (bug 18099) Using appendtext to edit a non-existent page causes an interface + message to be included in the page text === Languages updated in 1.15 === diff --git a/includes/api/ApiEditPage.php b/includes/api/ApiEditPage.php index a66006b2c1..1e392764ff 100644 --- a/includes/api/ApiEditPage.php +++ b/includes/api/ApiEditPage.php @@ -75,7 +75,14 @@ class ApiEditPage extends ApiBase { $toMD5 = $params['text']; if(!is_null($params['appendtext']) || !is_null($params['prependtext'])) { - $content = $articleObj->getContent(); + // For non-existent pages, Article::getContent() + // returns an interface message rather than '' + // We do want getContent()'s behavior for non-existent + // MediaWiki: pages, though + if($articleObj->getID() == 0 && $titleObj->getNamespace() != NS_MEDIAWIKI) + $content = ''; + else + $content = $articleObj->getContent(); $params['text'] = $params['prependtext'] . $content . $params['appendtext']; $toMD5 = $params['prependtext'] . $params['appendtext']; }