From 1b53f3f6e222f9108c7b35f47cbfa38d447208ea Mon Sep 17 00:00:00 2001 From: Roan Kattouw Date: Wed, 7 Nov 2018 15:04:50 -0800 Subject: [PATCH] ResourceLoader: Fail less hard when JSON serialization of config fails Instead of throwing an exception on the PHP side, log an error on the JS side. Change-Id: I673f59d936e48072e78f6b061ac06f37274ded77 --- includes/resourceloader/ResourceLoader.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/resourceloader/ResourceLoader.php b/includes/resourceloader/ResourceLoader.php index 2fc81e37b6..9570e038a8 100644 --- a/includes/resourceloader/ResourceLoader.php +++ b/includes/resourceloader/ResourceLoader.php @@ -1529,10 +1529,12 @@ MESSAGE; self::inDebugMode() ); if ( $js === false ) { - throw new Exception( + $e = new Exception( 'JSON serialization of config data failed. ' . 'This usually means the config data is not valid UTF-8.' ); + MWExceptionHandler::logException( $e ); + $js = Xml::encodeJsCall( 'mw.log.error', [ $e->__toString() ] ); } return $js; } -- 2.20.1