X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFormatJson.php;h=8cb22dd1ba0511d9b224d2790be282e6a605ed5a;hb=a5c7fd0db2d962834127ec2362d0dfe8ef6852d5;hp=9dcde8f32b23883f622bdd9eb88683c453a1920f;hpb=4ad455a73c0625288d62a67bb1e317d2921b8a57;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index 9dcde8f32b..8cb22dd1ba 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -88,6 +88,13 @@ class ApiFormatJson extends ApiFormatBase { } $data = $this->getResult()->getResultData( null, $transform ); $json = FormatJson::encode( $data, $this->getIsHtml(), $opt ); + if ( $json === false ) { + // This should never happen, but it's a bug which could crop up + // if you use ApiResult::NO_VALIDATE for instance. + // @codeCoverageIgnoreStart + $this->dieDebug( __METHOD__, 'Unable to encode API result as JSON' ); + // @codeCoverageIgnoreEnd + } // T68776: OutputHandler::mangleFlashPolicy() avoids a nasty bug in // Flash, but what it does isn't friendly for the API, so we need to