Austinb / GameQ

A PHP Gameserver Status Query Library
https://austinb.github.io/GameQ/
GNU Lesser General Public License v3.0
403 stars 137 forks source link

Arma 3 Returns Invalid UTF-8 Characters / Add a Check for Invalid Data #378

Closed ZacharyDuBois closed 7 years ago

ZacharyDuBois commented 7 years ago

When querying Arma 3, GameQ (v3.0.10 via composer) sets invalid keys and UTF-8 characters causing PHP to handle the array improperly. Filtering the array and enforcing utf8_encode does not work because the characters are invalid to begin with.

I am not sure if it is an Arma 3 issue or GameQ. But, it shouldn't be returned in the array if the data is not valid to begin with. Ref: #377.

Output:

  array(40) {
    [""]=>
    string(127) "MJ[b^B[ǣ"    Protected4%eServer V1.1mY@extDB3_JServer_Filesa3 Blastcorejsrs-apex-h"
    [""]=>
    string(17) "andling jsrs-apex"
    ["dedicated"]=>
    string(1) "d"
    ["game_descr"]=>
    string(21) "Altis Life RPG 4.4 R3"
    ["game_dir"]=>
    string(5) "Arma3"
    ["game_id"]=>
    int(107410)
    ["gq_address"]=>
    string(13) "74.91.119.204"
    ["gq_dedicated"]=>
    string(1) "d"
    ["gq_gametype"]=>
    string(21) "Altis Life RPG 4.4 R3"
    ["gq_hostname"]=>
    string(63) "[US] TangoWorldWide | Altis Life Roleplay | Chicago | 64bit | P"
    ["gq_joinlink"]=>
    string(35) "steam://connect/74.91.119.204:2302/"
    ["gq_mapname"]=>
    string(5) "Altis"
    ["gq_maxplayers"]=>
    int(80)
    ["gq_mod"]=>
    string(5) "Arma3"
    ["gq_name"]=>
    string(13) "Source Server"
    ["gq_numplayers"]=>
    int(0)
    ["gq_online"]=>
    bool(true)
    ["gq_password"]=>
    int(0)
    ["gq_port_client"]=>
    int(2302)
    ["gq_port_query"]=>
    int(2303)
    ["gq_protocol"]=>
    string(6) "source"
    ["gq_transport"]=>
    string(3) "udp"
    ["gq_type"]=>
    string(6) "source"
    ["hostname"]=>
    string(63) "[US] TangoWorldWide | Altis Life Roleplay | Chicago | 64bit | P"
    ["keywords"]=>
    string(92) "bt,r168,n0,s7,i3,mf,lf,vt,dt,trpg,g65545,h1fa436c1,c-2147483648--2147483648,f0,pw,e15,j0,k0,"
    ["map"]=>
    string(5) "Altis"
    ["max_players"]=>
    int(80)
    ["num_bots"]=>
    int(0)
    ["num_players"]=>
    int(0)
    ["num_rules"]=>
    int(2)
    ["os"]=>
    string(1) "w"
    ["password"]=>
    int(0)
    ["players"]=>
    array(0) {
    }
    ["port"]=>
    int(2302)
    ["protocol"]=>
    int(17)
    ["secure"]=>
    int(0)
    ["steam_id"]=>
    int(90108444745762816)
    ["steamappid"]=>
    int(0)
    ["teams"]=>
    array(0) {
    }
    ["version"]=>
    string(11) "1.68.141112"
  }
Austinb commented 7 years ago

@ZacharyDuBois Generally bad keys from the return array are due to incomplete responses from the server. Does this issue happen all the time or just occasionally? Can you provide some example servers ip:port information so I can test? I would like to fix these kinds of issues if possible.

ZacharyDuBois commented 7 years ago

The only one I had was the one listed above. However, that server has been closed since then.

Austinb commented 7 years ago

If you see it again please reopen this issue or create a new one and reference this issue.