From de3fc8f765d9a8e891492615a76cc3223499db89 Mon Sep 17 00:00:00 2001 From: Gilles Dubuc Date: Mon, 19 Nov 2018 11:49:23 +0100 Subject: [PATCH] Log error when array_flip fails in MessageCache load Bug: T208897 Change-Id: If6e7a6a3019abbdc11b6604ec706cc88bfddf128 --- includes/cache/MessageCache.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/includes/cache/MessageCache.php b/includes/cache/MessageCache.php index 5ada42fb77..b669fcd492 100644 --- a/includes/cache/MessageCache.php +++ b/includes/cache/MessageCache.php @@ -270,6 +270,17 @@ class MessageCache { $this->overridable = array_flip( Language::getMessageKeysFor( $code ) ); + // T208897 array_flip can fail and return null + if ( is_null( $this->overridable ) ) { + LoggerFactory::getInstance( 'MessageCache' )->error( + __METHOD__ . ': $this->overridable is null', + [ + 'message_keys' => Language::getMessageKeysFor( $code ), + 'code' => $code + ] + ); + } + # 8 lines of code just to say (once) that message cache is disabled if ( $this->mDisable ) { static $shownDisabled = false; -- 2.20.1