Skip to content

fix: migrate $_REQUEST to ServerRequest in SearchController#20122

Merged
MauricioFauth merged 2 commits intophpmyadmin:masterfrom
somethingwithproof:fix/serverrequest-search-controller
Mar 2, 2026
Merged

fix: migrate $_REQUEST to ServerRequest in SearchController#20122
MauricioFauth merged 2 commits intophpmyadmin:masterfrom
somethingwithproof:fix/serverrequest-search-controller

Conversation

@somethingwithproof
Copy link
Copy Markdown
Contributor

@somethingwithproof somethingwithproof commented Feb 17, 2026

Summary

Test plan

  • Verify database search page loads correctly
  • Verify AJAX search results still render without full page reload
  • Run phpstan and phpcs to confirm no regressions

Refs #16276, #17769

@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch from 9ae6539 to 5abf610 Compare February 17, 2026 23:35
@kamil-tekiela
Copy link
Copy Markdown
Contributor

kamil-tekiela commented Feb 17, 2026

It seems to me like it could be safely replaced in one go across the whole repo.

@somethingwithproof
Copy link
Copy Markdown
Contributor Author

That makes sense — I can put together a single PR that covers all remaining $_REQUEST usages if that's preferred. Would you like me to close this one and the DesignerController PR (#20125) in favor of a combined replacement?

@kamil-tekiela
Copy link
Copy Markdown
Contributor

That makes sense — I can put together a single PR that covers all remaining $_REQUEST usages if that's preferred. Would you like me to close this one and the DesignerController PR (#20125) in favor of a combined replacement?

I was only referring to ajax_page_request as they all should use has().

@somethingwithproof
Copy link
Copy Markdown
Contributor Author

Got it — scoped to ajax_page_request only, not all $_REQUEST usages. I'll update this PR to cover all the remaining $_REQUEST['ajax_page_request']$request->has('ajax_page_request') replacements across the repo and apply your inline suggestion. Will close #20125 since it's a separate change.

@somethingwithproof
Copy link
Copy Markdown
Contributor Author

Expanded scope: migrated all remaining ajax_page_request usages repo-wide to $request->has('ajax_page_request').

Changed files:

  • src/Controllers/Database/EventsController.php
  • src/Controllers/Database/RoutinesController.php
  • src/Controllers/Server/PrivilegesController.php
  • src/Controllers/Triggers/IndexController.php
  • src/Server/Privileges.php (now accepts ServerRequest param)
  • tests/unit/Server/PrivilegesTest.php (updated to use request objects)

All 5183 unit tests pass locally.

Copy link
Copy Markdown
Member

@MauricioFauth MauricioFauth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You did a bad git rebase. Please revert the unrelated changes.

@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch from c7452ae to 6e91cfd Compare February 22, 2026 22:06
@somethingwithproof
Copy link
Copy Markdown
Contributor Author

Rebased cleanly onto master — the branch now has a single commit with only the ajax_page_request migration across all remaining controllers and Privileges.php. Sorry about the mess earlier.

Per @kamil-tekiela's suggestion, this covers all remaining $_REQUEST['ajax_page_request'] usages repo-wide, not just SearchController.

@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch from 6e91cfd to 7b0fa89 Compare February 23, 2026 02:15
@somethingwithproof
Copy link
Copy Markdown
Contributor Author

Rebased clean on master — single commit, no unrelated changes. The Weblate commits from the earlier push are gone.

The ajax_page_request migration uses $request->has() as kamil-tekiela suggested. Also passes ServerRequest into getHtmlForUserOverview() to eliminate the remaining $_REQUEST access in Privileges.php.

7 files changed, tests pass (93 tests, 424 assertions).

@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch from 7b0fa89 to f61c318 Compare February 24, 2026 02:46
* Get HTML snippet for display user overview page
*/
public function getHtmlForUserOverview(UserPrivileges $userPrivileges, string|null $initial): string
public function getHtmlForUserOverview(UserPrivileges $userPrivileges, string|null $initial, ServerRequest $request): string
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in the latest push.

@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch from f61c318 to 564d1b9 Compare February 24, 2026 09:21
@somethingwithproof
Copy link
Copy Markdown
Contributor Author

Rebased onto master and fixed the 120-char line in Privileges.php:2465 — split the method signature across multiple lines.

@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch 3 times, most recently from 9480562 to 3ba8704 Compare February 26, 2026 00:36
@codecov
Copy link
Copy Markdown

codecov bot commented Feb 26, 2026

Codecov Report

❌ Patch coverage is 0% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 63.24%. Comparing base (690be10) to head (3ba8704).
⚠️ Report is 28 commits behind head on master.

Files with missing lines Patch % Lines
src/Controllers/Database/SearchController.php 0.00% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master   #20122      +/-   ##
============================================
- Coverage     63.44%   63.24%   -0.21%     
+ Complexity    16090    16088       -2     
============================================
  Files           668      675       +7     
  Lines         60072    60071       -1     
============================================
- Hits          38114    37993     -121     
- Misses        21958    22078     +120     
Flag Coverage Δ
dbase-extension ?
unit-8.4-ubuntu-latest 63.18% <0.00%> (?)
unit-8.5-ubuntu-latest 63.24% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch 2 times, most recently from 71c6297 to 3c9f0fe Compare February 27, 2026 06:59
Replace `empty($_REQUEST['ajax_page_request'])` with
`! $request->has('ajax_page_request')` to use the injected
ServerRequest consistently.

Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof somethingwithproof force-pushed the fix/serverrequest-search-controller branch from 3c9f0fe to 12ff061 Compare March 1, 2026 04:56
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@MauricioFauth MauricioFauth merged commit f0f71c5 into phpmyadmin:master Mar 2, 2026
42 of 43 checks passed
@MauricioFauth MauricioFauth self-assigned this Mar 2, 2026
@MauricioFauth MauricioFauth added this to the 6.0.0 milestone Mar 2, 2026
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

Successfully merging this pull request may close these issues.

4 participants