Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

long2ip issue #16

Closed
1 task done
Colatino opened this issue Jul 29, 2023 · 3 comments
Closed
1 task done

long2ip issue #16

Colatino opened this issue Jul 29, 2023 · 3 comments

Comments

@Colatino
Copy link

Colatino commented Jul 29, 2023

Priority

Low

Area

Admin

What OS are you seeing the problem on?

Windows

Browser

Chrome

What happened?

A bug happened!

While trying to edit players on the Admin panel there was the following error:

Exception class: TypeError()

long2ip(): Argument #1 ($ip) must be of type int, string given

File: D:\Andre\OT13\UniServerZ\www\system\functions.php
Line: 66


Backtrace:

#0 D:\Andre\OT13\UniServerZ\www\system\functions.php(66): long2ip()
#1 D:\Andre\OT13\UniServerZ\www\admin\pages\players.php(700): longToIp()
#2 D:\Andre\OT13\UniServerZ\www\admin\index.php(62): include('...')
#3 {main}

I fixed it by changing this line to this:

value="<?= (strlen($player->getLastIP()) > 11) ? inet_ntop($player->getLastIP()) : longToIp(intval($player->getLastIP())); ?>"

I'm running MyAAC on Uniform server and PHP 8.1.6

Code of Conduct

  • I agree to follow this project's Code of Conduct
@github-actions github-actions bot added bug Something isn't working Status: Pending Test labels Jul 29, 2023
@elsongabriel
Copy link
Collaborator

elsongabriel commented Jul 31, 2023

Have you updated your repo? In line 66 we have line empty
image

and for myaac, is recommended to use PHP 7.4

@Colatino
Copy link
Author

Colatino commented Jul 31, 2023

I didn't clone the repo, I got it from another website and it's probably an older version. In the current version the longtoip function is present but on line 82 and it is the same as my version and it still calls for PHP's long2ip, that is the real cause of the trouble.

Maybe updating the repo would solve the issue and maybe using PHP 7.4 would solve the problem but requirements say 7.4 or later.

I think maybe my "solution" make it more compatible.

@elsongabriel
Copy link
Collaborator

I didn't clone the repo, I got it from another website and it's probably an older version. In the current version the longtoip function is present but on line 82 and it is the same as my version and it still calls for PHP's long2ip, that is the real cause of the trouble.

Maybe updating the repo would solve the issue and maybe using PHP 7.4 would solve the problem but requirements say 7.4 or later.

I think maybe my "solution" make it more compatible.

Yes. I saw your fix in player.php
the function longToIp() explodes an $ip string in long2ip() function.

I think the validation could be in function longToIp($ip)
to check if string or int before cast.

@elsongabriel elsongabriel closed this as not planned Won't fix, can't repro, duplicate, stale Aug 15, 2023
@majestyotbr majestyotbr removed Status: Pending Test bug Something isn't working labels Nov 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants