From 35320775e3a8400d09f23ac01e4dfbba7dd475db Mon Sep 17 00:00:00 2001 From: Martin Urbanec Date: Wed, 2 Aug 2023 17:52:11 +0200 Subject: [PATCH] ApiVisualEditorEdit: Make tags param actually work Why: ApiVisualEditorEdit passes most of its params down to action=edit. However, $params contains parsed version of the params. Using it with tags results in the param validator logic on ApiEdit's end receiving a PHP array, which it does not expect (neither it should; it is impossible to pass one via an actual API call). This feature will be used in DiscussionTools, which itself reuses ApiVisualEditorEdit. What: Use WebRequest::getText() to get the unparsed value for 'tags', which makes the parameter forwarding actually work. Bug: T343339 Change-Id: I0ac60ca8473fe28461b2da60f9911baac4994388 --- includes/ApiVisualEditorEdit.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/ApiVisualEditorEdit.php b/includes/ApiVisualEditorEdit.php index 39ae22770b..c01a9688f0 100644 --- a/includes/ApiVisualEditorEdit.php +++ b/includes/ApiVisualEditorEdit.php @@ -92,7 +92,9 @@ class ApiVisualEditorEdit extends ApiBase { 'starttimestamp' => $params['starttimestamp'], 'token' => $params['token'], 'watchlist' => $params['watchlist'], - 'tags' => $params['tags'], + // NOTE: Must use getText() to work; PHP array from $params['tags'] is not understood + // by the edit API. + 'tags' => $this->getRequest()->getText( 'tags' ), 'section' => $params['section'], 'sectiontitle' => $params['sectiontitle'], 'captchaid' => $params['captchaid'],