A1mDev / hlstatsx-community-edition

HLstatsX Community Edition - PHP 7,8 - and GeoIP2 supported
GNU General Public License v2.0
25 stars 11 forks source link

PHP 7/8 Migration Bugs - some Hlstats Funktions not working eg Latency, Suicides #19

Open stive101 opened 1 month ago

stive101 commented 1 month ago

Hello,

When you want to add Actions and save them, it doesn't work due to a MySQL error. The error indicates "not allowed commun ''," in the hlstats_actions row for reward_teams. This happens because 0 is not a valid number; it means nothing, but it must be a number. This function has changed in PHP 7. Latency and Suicides won't work. I tested it with PHP 5.6 and the old version of HLstats (1.6.19), where it works, but not with 1.7 or any other forks.

I'm not very skilled in PHP, but I think there might be two reasons for this issue:

  1. The way things have changed in PHP 7/8 affects how the data (Latency and Suicides) is retrieved from the server and stored in the database.
  2. The fix for CSGO has broken the function for TF2 or other games.

It would be great if you could look into this because I'm not good enough to do it without causing 100 PHP errors. I tried to fix it by using serverpm hlstatspl and playerpm from version 1.6.19, but that caused too many errors because it's written in PHP 5.6.

Thanks!

DNA-styx commented 1 month ago

Latency This code got this working for me: https://github.com/DNA-styx/hlstatsx-community-edition/commit/4282b04f4abaea78211b429b8660bccb623085b2

stive101 commented 1 month ago

thank you, i will try to implement that soon for testing, did u also find out the suicide issue ?

edit : nah wont work for me ;( wich php version did u use to test ?

im using a source sdk multiplayer 2013 mod and php7.2, in this configuration it wont work,

maybe the bug is in the function itselfs becouse that following thing wont be written in the log : Update Player pings

im only see the message, when i use php 5.6 with 1.6.19

but cracy thing is, with php5.6 and HLstats 1.6.19, ping and suicide works XD

DNA-styx commented 1 month ago

suicide I applied this one and I'm seeing them getting logged https://github.com/startersclan/hlstatsx-community-edition/commit/732a47a8c9cc3153e5f3627ffcf8128ddd8f6f42#diff-dcb8718d07bb9a409683086d227ccc63d5e4e32a11fa4fdef5c433f9c1fc3f76R3017

Ping I'm running 8.3. It did take a couple of days to appear.

stive101 commented 1 month ago

ok both work now, thanks :=)