[API] userinfo.php doesn't return valid JSON for incorrect usernames

I was trying to do some error handling with the script and show proper error when username is incorrect but turns out the script returns an invalid JSON if you give a non-existent username for “nickname”.

 

Case: http://web.star-conflict.com/pubapi/v1/userinfo.php?nickname=lalalalala

Result: 

{ result: "error", "code": 1, "text": "Invalid username/nickname" }

notice how result doesn’t have double quotes around it. JSON parser expects double quotes and throws error- 

parsererror SyntaxError: Unexpected token r

While i’m at it, might as well report that the script returns weird result on some specific usernames (i’m assuming it happens with some other usernames as well, so far i’ve only encountered one)

i.e. Shepard27 [esb]

 

http://web.star-conflict.com/pubapi/v1/userinfo.php?nickname=Shepard27

 

In this case the value of “pvp” is an empty array. Ingame, however, his profile is shown as expected

 

I reported this to Antibus a long while ago but it still persists

 


 

P.S. Skill rating has now been changed for good but the script still doesn’t give skillRating value

fixed

Awesome! That was swift