Skip to content
This repository has been archived by the owner on Jun 13, 2020. It is now read-only.

Web error after 1/19/16 gmod update #242

Closed
ZachPL opened this issue Jan 22, 2016 · 20 comments
Closed

Web error after 1/19/16 gmod update #242

ZachPL opened this issue Jan 22, 2016 · 20 comments

Comments

@ZachPL
Copy link
Contributor

ZachPL commented Jan 22, 2016

http://imgur.com/xbxvM2L

This started happening right after the most recent gmod updates where it sometimes will append the steamid to the end and not show the names of players.

I checked and my damagelogs are fine before tuesday and this started happening afterwords.

http://assets-1.joinsg.net/tttdamage/index.php?static&round_list=21021&map_loaded_list=21018_21021&day_list=2016_1_19&month_list=2016_1&year_list=2016

Anyone having this issue and fixed this already?

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 23, 2016

This week's patch notes

util.TableToJSON handles arrays properly

Pretty sure it has something to do with that

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 27, 2016

@EstevanTH Any chance you could retake a look at this.

@comedinha
Copy link
Contributor

Neutron have same problem... http://i.imgur.com/Fy1iDri.png

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 27, 2016

interesting, let me know if a fix comes out for it so I can cross reference, I dont have access to that script currently.

I pulled the decoded json from php and it looks right... but i'm not sure what it looked like before the update and have no way to look.

I have next to 0 experience with json and php so im struggling through it

@EstevanTH
Copy link

Hello,
I totally forgot this PHP script. 😳
I have no TTT server so I can try nothing. Having an piece of database would be handy.
I rather think that the problem comes from Garry's Mod, so the contents of the database is corrupted.

@CSchulz
Copy link
Contributor

CSchulz commented Jan 28, 2016

It would be easy to fix the PHP script, but I think the old logs are lost without any migration to the "new" format.

@EstevanTH
Copy link

I think that the script does not decode valid information while doing

$round_info['damagelog'] = json_decode($round_info['damagelog'], true);

in website_code/index.php at line 453

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 28, 2016

@EstevanTH I'm not sure if this helps at all

I put this in a file
$round_info['damagelog'] = json_decode($round_info['damagelog'], true);
echo var_dump($round_info['damagelog']), '
';

which displays this
http://assets.joinsg.net/tttdamage/event.php

Are you able to tell if that is correct or not?

@EstevanTH
Copy link

Can I see the damagelog page for the date you chose to display in your link?

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 28, 2016

Here is the link

http://assets.joinsg.net/tttdamage/index.php?static&round_list=22241&map_loaded_list=22234_22241&day_list=2016_1_24&month_list=2016_1&year_list=2016

its round 8 4:26 am tttminecraft_mythic_sg_b9 (3:58 AM) on the 24 of january 2016

@EstevanTH
Copy link

A failing example:

    [3]=>
        array(5) {
            ["round"]=>
            int(8)
            ["infos"]=>
            array(9) {
                [0]=>
                string(13) "Unpaid Intern"
                [1]=>
                int(1)
                [2]=>
                string(7) "jwjg672"
                [3]=>
                int(0)
                [4]=>
                int(9)
                [5]=>
                string(14) "weapon_ttt_m16"
                [6]=>
                string(18) "STEAM_0:1:123456"
                [7]=>
                string(19) "STEAM_0:1:234567"
                [8]=>
                int(9)
            }
            ["id"]=>
            int(1)
            ["type"]=>
            string(3) "DMG"
            ["time"]=>
            int(60)
        }

A working example:

        [4]=>
        array(5) {
            ["round"]=>
            int(8)
            ["infos"]=>
            array(10) {
                [2]=>
                int(0)
                [5]=>
                int(200)
                [4]=>
                int(0)
                [9]=>
                int(200)
                [8]=>
                string(18) "STEAM_0:0:123456"
                [3]=>
                string(15) "BlackWolf-TFMV-"
                [7]=>
                string(19) "STEAM_0:1:234567"
                [1]=>
                string(7) "jwjg672"
                ["icon"]=>
                array(1) {
                    [0]=>
                    string(22) "icon16/exclamation.png"
                }
                [6]=>
                string(15) "weapon_zm_rifle"
            }
            ["id"]=>
            int(1)
            ["type"]=>
            string(3) "DMG"
            ["time"]=>
            int(62)
        }

I regret that this happens. I do not remember what the JSON data look like.
I can't fix by just checking whether the key 0 exists or not.
Can you please capture JSON data before they get decoded at line 413?

$round_info['damagelog'] = json_decode($round_info['damagelog'], true);

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 29, 2016

@EstevanTH
http://assets.joinsg.net/tttdamage/event2.php

I believe that is what you are asking for

@EstevanTH
Copy link

I added tabs and new lines to make the JSON data readable.

{
    "ShootTable":
    {
        "6":[
            [
                "Weegee",
                "weapon_zm_molotov"
            ]
        ],
        "9":[
            [
                "jwjg672",
                "weapon_zm_revolver"
            ]
        ],
        "12":[
            [
                "jwjg672",
                "weapon_zm_revolver"
            ]
        ],
        "13":[
            [
                "jwjg672",
                "weapon_zm_revolver"
            ]
        ],
        "14":[
            [
                "jwjg672",
                "weapon_zm_revolver"
            ]
        ],
        "67":[
            [
                "Unpaid Intern",
                "weapon_zm_shotgun"
            ]
        ],
        "84":[
            [
                "Unpaid Intern",
                "weapon_zm_shotgun"
            ]
        ],
        "83":[
            [
                "Unpaid Intern",
                "weapon_zm_shotgun"
            ]
        ],
        "62":[
            [
                "BlackWolf-TFMV-",
                "weapon_zm_rifle"
            ]
        ],
        "24":[
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ]
        ],
        "23":[
            [
                "jwjg672",
                "weapon_ttt_m16"
            ]
        ],
        "60":[
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ]
        ],
        "57":[
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ]
        ],
        "66":[
            [
                "Unpaid Intern",
                "weapon_zm_shotgun"
            ]
        ],
        "56":[
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ]
        ],
        "61":[
            [
                "jwjg672",
                "weapon_ttt_m16"
            ]
        ],
        "59":[
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ],
            [
                "jwjg672",
                "weapon_ttt_m16"
            ]
        ]
    },
    "Infos":
    {
        "BlackWolf-TFMV-":
        {
            "role":0,
            "steamid64":"76561198140000000",
            "steamid":"STEAM_0:1:123456"
        },
        "Unpaid Intern":
        {
            "role":1,
            "steamid64":"76561198140000000",
            "steamid":"STEAM_0:1:123456"
        },
        "Weegee":
        {
            "role":0,
            "steamid64":"76561198140000000",
            "steamid":"STEAM_0:1:123456"
        },
        "jwjg672":
        {
            "role":0,
            "steamid64":"76561198140000000",
            "steamid":"STEAM_0:1:123456"
        }
    },
    "DamageTable":[
        {
            "round":8,
            "infos":[
                "Unpaid Intern",
                1,
                "STEAM_0:1:123456",
                2,
                2
            ],
            "id":8,
            "type":"WEP",
            "time":3
        },
        {
            "round":8,
            "infos":[
                "Unpaid Intern",
                1,
                "STEAM_0:1:123456",
                1,
                1
            ],
            "id":8,
            "type":"WEP",
            "time":5
        },
        {
            "round":8,
            "infos":[
                "Weegee",
                0,
                "weapon_zm_molotov",
                "STEAM_0:1:123456"
            ],
            "id":6,
            "type":"NADE",
            "time":6
        },
        {
            "round":8,
            "infos":[
                "Unpaid Intern",
                1,
                "jwjg672",
                0,
                9,
                "weapon_ttt_m16",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                9
            ],
            "id":1,
            "type":"DMG",
            "time":60
        },
        {
            "round":8,
            "infos":
            {
                "2":0,
                "5":200,
                "4":0,
                "9":200,
                "8":"STEAM_0:1:123456",
                "3":"BlackWolf-TFMV-",
                "7":"STEAM_0:1:123456",
                "1":"jwjg672",
                "icon":[
                    "icon16/exclamation.png"
                ],
                "6":"weapon_zm_rifle"
            },
            "id":1,
            "type":"DMG",
            "time":62
        },
        {
            "round":8,
            "infos":[
                "BlackWolf-TFMV-",
                0,
                "jwjg672",
                0,
                "weapon_zm_rifle",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                73
            ],
            "id":4,
            "type":"KILL",
            "time":62
        },
        {
            "round":8,
            "infos":[
                "BlackWolf-TFMV-",
                0,
                "Unpaid Intern",
                1,
                67,
                "weapon_zm_shotgun",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                67
            ],
            "id":1,
            "type":"DMG",
            "time":66
        },
        {
            "round":8,
            "infos":[
                "BlackWolf-TFMV-",
                0,
                "Unpaid Intern",
                1,
                55,
                "weapon_zm_shotgun",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                55
            ],
            "id":1,
            "type":"DMG",
            "time":67
        },
        {
            "round":8,
            "infos":[
                "Unpaid Intern",
                1,
                "BlackWolf-TFMV-",
                0,
                "weapon_zm_shotgun",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                74
            ],
            "id":4,
            "type":"KILL",
            "time":67
        },
        {
            "round":8,
            "infos":
            {
                "2":1,
                "5":"weapon_ttt_flaregun",
                "3":"STEAM_0:1:123456",
                "1":"Unpaid Intern"
            },
            "id":8,
            "type":"WEP",
            "time":75
        },
        {
            "round":8,
            "infos":[
                "Weegee",
                0,
                "Unpaid Intern",
                1,
                55,
                "weapon_zm_shotgun",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                55
            ],
            "id":1,
            "type":"DMG",
            "time":83
        },
        {
            "round":8,
            "infos":[
                "Weegee",
                0,
                "Unpaid Intern",
                1,
                78,
                "weapon_zm_shotgun",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                78
            ],
            "id":1,
            "type":"DMG",
            "time":84
        },
        {
            "round":8,
            "infos":[
                "Unpaid Intern",
                1,
                "Weegee",
                0,
                "weapon_zm_shotgun",
                "STEAM_0:1:123456",
                "STEAM_0:1:123456",
                75
            ],
            "id":4,
            "type":"KILL",
            "time":84
        }
    ]
}

I need some time to understand what the failure is.

@EstevanTH
Copy link

Okay, the failure is easy to understand.
In failing DamageTable events, the data are naturally indexed (using an integer key, which is 1 to n in Lua and 0 to n-1 in PHP).
In successing DamageTable events, the data are indexed by a string containing an integer (probably using a integer-to-string key, which was 1 to n in Lua, so it is incorrectly converted in PHP).

When I made the PHP script, everything was probably in the integer-to-string format, that's why only events containing integer-to-string keys are displayed properly.

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 29, 2016

So this is just a issue with the PHP script formatting? Any chance you could fix it?

@Tommy228
Copy link
Owner

Can you try now? I have justed updated sh_events.lua

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 29, 2016

Yep, that fixed it. At least on the web, i'll check ingame to make sure later tonight.

If only I knew the fix was that easy. Thanks!

@ZachPL
Copy link
Contributor Author

ZachPL commented Jan 30, 2016

As far as I can tell everything seems good.

@comedinha
Copy link
Contributor

Fixed for me

@ZachPL ZachPL closed this as completed Mar 29, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants