From: Roan Kattouw Date: Wed, 7 Nov 2018 23:04:50 +0000 (-0800) Subject: ResourceLoader: Fail less hard when JSON serialization of config fails X-Git-Tag: 1.34.0-rc.0~3539 X-Git-Url: http://git.cyclocoop.org/?a=commitdiff_plain;h=1b53f3f6e222f9108c7b35f47cbfa38d447208ea;p=lhc%2Fweb%2Fwiklou.git 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 --- 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; }