From 8415d7f7bfe87be2d514db8c3084868e225bfeca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bartosz=20Dziewo=C5=84ski?= Date: Sun, 16 Aug 2020 21:06:18 +0200 Subject: [PATCH] ApiVisualEditor: Fix 'false' used as content for non-existent system messages getDefaultMessageText() returns false when the message doesn't exist. It was incorrectly treated as a string by this code. Follow-up to 3ec5e04a3764008761d4f215367a6aab4452a2a0. Change-Id: Ib94a30697bd20133e46cbd31c14caf5f0c4169dd --- includes/ApiVisualEditor.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/includes/ApiVisualEditor.php b/includes/ApiVisualEditor.php index fa4ce275f5..d2c88f320f 100644 --- a/includes/ApiVisualEditor.php +++ b/includes/ApiVisualEditor.php @@ -211,7 +211,10 @@ class ApiVisualEditor extends ApiBase { $content = ''; if ( $title->getNamespace() == NS_MEDIAWIKI && $params['section'] !== 'new' ) { // If this is a system message, get the default text. - $content = $title->getDefaultMessageText(); + $msg = $title->getDefaultMessageText(); + if ( $msg !== false ) { + $content = $title->getDefaultMessageText(); + } } Hooks::run( 'EditFormPreloadText', [ &$content, &$title ] ); if ( $content === '' && !empty( $params['preload'] ) ) {