mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Use JSON_THROW_ON_ERROR for json_encode() and json_decode()
This commit is contained in:
@ -27,7 +27,6 @@ use pocketmine\network\mcpe\protocol\ProtocolInfo;
|
||||
use pocketmine\player\Player;
|
||||
use pocketmine\scheduler\AsyncTask;
|
||||
use pocketmine\Server;
|
||||
use pocketmine\utils\AssumptionFailedError;
|
||||
use pocketmine\utils\Internet;
|
||||
use pocketmine\utils\Process;
|
||||
use pocketmine\utils\Utils;
|
||||
@ -37,11 +36,11 @@ use function array_map;
|
||||
use function array_values;
|
||||
use function count;
|
||||
use function json_encode;
|
||||
use function json_last_error_msg;
|
||||
use function md5;
|
||||
use function microtime;
|
||||
use function php_uname;
|
||||
use function strlen;
|
||||
use const JSON_THROW_ON_ERROR;
|
||||
use const PHP_VERSION;
|
||||
|
||||
class SendUsageTask extends AsyncTask{
|
||||
@ -150,9 +149,7 @@ class SendUsageTask extends AsyncTask{
|
||||
}
|
||||
|
||||
$this->endpoint = $endpoint . "api/post";
|
||||
$data = json_encode($data/*, JSON_PRETTY_PRINT*/);
|
||||
if($data === false) throw new AssumptionFailedError("Statistics JSON should never fail to encode: " . json_last_error_msg());
|
||||
$this->data = $data;
|
||||
$this->data = json_encode($data, /*JSON_PRETTY_PRINT |*/ JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
public function onRun() : void{
|
||||
|
Reference in New Issue
Block a user