mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-29 06:05:54 +00:00
TimingsCommand: beware crash on invalid timings server response
This commit is contained in:
parent
e30ae487dc
commit
c5a1c15389
@ -46,6 +46,8 @@ use function fwrite;
|
|||||||
use function http_build_query;
|
use function http_build_query;
|
||||||
use function implode;
|
use function implode;
|
||||||
use function is_array;
|
use function is_array;
|
||||||
|
use function is_int;
|
||||||
|
use function is_string;
|
||||||
use function json_decode;
|
use function json_decode;
|
||||||
use function mkdir;
|
use function mkdir;
|
||||||
use function strtolower;
|
use function strtolower;
|
||||||
@ -178,7 +180,7 @@ class TimingsCommand extends VanillaCommand{
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$response = json_decode($result->getBody(), true);
|
$response = json_decode($result->getBody(), true);
|
||||||
if(is_array($response) && isset($response["id"])){
|
if(is_array($response) && isset($response["id"]) && (is_int($response["id"]) || is_string($response["id"]))){
|
||||||
Command::broadcastCommandMessage($sender, KnownTranslationFactory::pocketmine_command_timings_timingsRead(
|
Command::broadcastCommandMessage($sender, KnownTranslationFactory::pocketmine_command_timings_timingsRead(
|
||||||
"https://" . $host . "/?id=" . $response["id"]));
|
"https://" . $host . "/?id=" . $response["id"]));
|
||||||
}else{
|
}else{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user