Draft
Conversation
cbaebaa to
871e541
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR removes the getPostData() and getQueryParameter() helper methods from UnityHTTPD class, replacing them with direct $_POST and $_GET array access. The approach relies on an existing error handler that converts undefined array key warnings into exceptions, though this changes the error response from "bad request" (400) to "internal server error" (500) for missing parameters.
Key changes:
- Removed
getPostData()andgetQueryParameter()methods fromUnityHTTPDclass - Replaced all usages with direct
$_POSTand$_GETaccess throughout the codebase - Updated CSRF token validation to use direct
$_POSTaccess
Reviewed changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
resources/lib/UnityHTTPD.php |
Removed getPostData() and getQueryParameter() methods; updated validatePostCSRFToken() to use direct $_POST access |
webroot/panel/pi.php |
Replaced getPostData() calls with direct $_POST access; removed $getUserFromPost closure |
webroot/panel/modal/pi_search.php |
Replaced getQueryParameter() with direct $_GET access |
webroot/panel/groups.php |
Replaced getPostData() with direct $_POST access |
webroot/panel/ajax/get_group_members.php |
Replaced getQueryParameter() with direct $_GET access |
webroot/panel/ajax/delete_message.php |
Replaced multiple getPostData() calls with direct $_POST access |
webroot/panel/account.php |
Replaced multiple getPostData() calls with direct $_POST access |
webroot/js/ajax/ssh_validate.php |
Replaced getPostData() with direct $_POST access |
webroot/js/ajax/ssh_generate.php |
Replaced getQueryParameter() with $_GET access for optional parameter |
webroot/api/content/index.php |
Replaced getQueryParameter() calls with $_GET access, using null coalescing for optional parameter |
webroot/admin/pi-mgmt.php |
Replaced multiple getPostData() calls with direct $_POST access; removed $getUserFromPost closure |
webroot/admin/ajax/get_page_contents.php |
Replaced getQueryParameter() with direct $_GET access |
webroot/admin/ajax/get_group_members.php |
Replaced getQueryParameter() with direct $_GET access |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
c60289a to
6747f7f
Compare
Member
Author
|
Closes #176 |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
6747f7f to
eaf4add
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR is at odds with #429. Marked as draft until one is chosen over the other.
Because we have an error handler registered which will convert any undefined array key warning into an exception, we don't need functions for strict array access.
One change of note is that a missing post data or query parameter used to cause "bad request", now it causes "internal server error".
I'm unsure about this because the error handler is a bit of a hack. Also, because phpunit doesn't play nice with user defined error handlers, tests cannot rely on its behavior. To make matters worse, PHPUnit deprecated the
expectNotice/expectWarningfunctions.