diff --git a/minequery.class.php b/minequery.class.php index e2d0652..c976c19 100644 --- a/minequery.class.php +++ b/minequery.class.php @@ -63,8 +63,9 @@ public static function query($address, $port = 25566, $timeout = 30) { $query['maxPlayers'] = $query['maxPlayers'][1]; // Player list - $query['playerList'] = explode(" ", $response[3], 2); - $query['playerList'] = explode(", ", trim($query['playerList'][1], "[]")); + list(, $buffer) = explode(" ", $response[3], 2); + $buffer = trim($buffer, "[] "); + $query['playerList'] = $buffer ? explode(", ", $buffer) : array(); $query['latency'] = $latency; diff --git a/test-failure-no-player-query.php b/test-failure-no-player-query.php index ff6d6f5..d9d608b 100644 --- a/test-failure-no-player-query.php +++ b/test-failure-no-player-query.php @@ -25,7 +25,7 @@ protected static function read($address, $port, &$errno, &$errstr, $timeout, $wr Minequery::$classname = 'MinequeryStub'; -$query = Minequery::query($host, $port, 3); +$query = Minequery::query($host); $playerList = $query['playerList']; $failure = array(""); $fixed = array();