Enclose compact() call in error suppression
authorMax Semenik <maxsem.wiki@gmail.com>
Sat, 28 Jul 2018 03:13:57 +0000 (20:13 -0700)
committerJames D. Forrester <jforrester@wikimedia.org>
Sat, 28 Jul 2018 15:09:19 +0000 (08:09 -0700)
In PHP 7.3, compact() now emits warnings when a variable doesn't exist.
Because our language files aren't required to contain all the possible
variables, this results in massive spam trying to run tests.

Change-Id: Idab0340ec1cdebfca67cb448e350a408438bcbbc

includes/cache/localisation/LocalisationCache.php

index 90108eb..9e2a2fd 100644 (file)
@@ -524,7 +524,12 @@ class LocalisationCache {
                Wikimedia\restoreWarnings();
 
                if ( $_fileType == 'core' || $_fileType == 'extension' ) {
+
+                       // Lnguage files aren't required to contain all the possible variables, so suppress warnings
+                       // when variables don't exist in tests
+                       Wikimedia\suppressWarnings();
                        $data = compact( self::$allKeys );
+                       Wikimedia\restoreWarnings();
                } elseif ( $_fileType == 'aliases' ) {
                        $data = compact( 'aliases' );
                } else {