-
Notifications
You must be signed in to change notification settings - Fork 30
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
Toggle off certain features & fix various bugs #128
Conversation
|
when we do the /f claim circle 999999999999999999999999999999999 or other it crashes the server, I removed the f enemy but I think I'm going to put it back and offer people to activate or deactivate it. |
we cant even cherry pick the good stuff out because it's all in one single commit |
What do you want to take? You want me to do multiple commits? One for subcommands and the others |
I did everything as you advised me if you have any suggestions or advice I will listen to them |
I will review this next month. |
Co-authored-by: Aericio <16523741+Aericio@users.noreply.github.com>
src/DaPigGuy/PiggyFactions/commands/subcommands/claims/unclaim/UnclaimSquareSubCommand.php
Outdated
Show resolved
Hide resolved
src/DaPigGuy/PiggyFactions/commands/subcommands/claims/unclaim/UnclaimSquareSubCommand.php
Show resolved
Hide resolved
src/DaPigGuy/PiggyFactions/commands/subcommands/claims/unclaim/UnclaimSquareSubCommand.php
Outdated
Show resolved
Hide resolved
src/DaPigGuy/PiggyFactions/commands/subcommands/TopSubCommand.php
Outdated
Show resolved
Hide resolved
src/DaPigGuy/PiggyFactions/commands/subcommands/claims/unclaim/UnclaimSubCommand.php
Outdated
Show resolved
Hide resolved
… limit and set true to default for the new config
I put everything you advise, thank you very much |
We should just add command blacklisting instead, probably. |
Having set limit for the /f top "PHP_INT_MAX" does not fix the main bug which is /f top power or member 999999999999999 and -999999999999999 |
Why this PR deals with so many things.. By the way, limiting to PHP_INT_MAX will probably not suffice for commands that require complex calculations or database calls. As it could lead to hidden performance issues. |
All commands that have an int can cause a crash, they should all be fixed at the same time |
@dadodasyra thanks for the feedback. I'll most likely cherrypick the commits from this PR instead of merging. About PHP_INT_MAX, should we just set the maximum to some reasonable limit instead then? like 100000. @FahZohh Agreed. Maybe a helper function to validate numbers. Not sure what the best way to handle this is. |
so we need to put a limit of 100000 for all commands that contain an int, but I have a question that won't do like last time or an extremely large number would probably result in an int overflow thus causing it to become a float ? |
Oh, I see why this is still the case. foreach (array_slice($factions, $page * self::PAGE_LENGTH, self::PAGE_LENGTH) as $rank => $faction) Page being multiplied by 10 here, so it'll just turn back into a float here. |
This should be a better solution. We set the max as the number of possible factions, instead of PHP_INT_MAX. |
ok, seems to be working. don't feel like cherrypicking so weee |
Please make sure your pull request complies with these guidelines:
What does the PR change?
/f top
with large negative/positive numbers crashing server. (Toggle off certain features & fix various bugs #128)/f claim
with large radiuses for circle/square toggles crashing server. (Toggle off certain features & fix various bugs #128)/f promote
on an offline user crashing server. (Toggle off certain features & fix various bugs #128)Testing Environment