X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fapi%2FApiFormatJson.php;h=8cb22dd1ba0511d9b224d2790be282e6a605ed5a;hb=a5c7fd0db2d962834127ec2362d0dfe8ef6852d5;hp=2f63faffe837e5210b8ff4c309389a40399b0f90;hpb=967a96e7fa5910f8fc451590decb381dbfb481ba;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/api/ApiFormatJson.php b/includes/api/ApiFormatJson.php index 2f63faffe8..8cb22dd1ba 100644 --- a/includes/api/ApiFormatJson.php +++ b/includes/api/ApiFormatJson.php @@ -81,11 +81,20 @@ class ApiFormatJson extends ApiFormatBase { default: // Should have been caught during parameter validation + // @codeCoverageIgnoreStart $this->dieDebug( __METHOD__, 'Unknown value for \'formatversion\'' ); + // @codeCoverageIgnoreEnd } } $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