Skip to content

fix: resolve #[RequestParam] annotations before filtering in processRequest() flow#103

Merged
usernane merged 1 commit into
mainfrom
dev
May 3, 2026
Merged

fix: resolve #[RequestParam] annotations before filtering in processRequest() flow#103
usernane merged 1 commit into
mainfrom
dev

Conversation

@usernane

@usernane usernane commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Resolves #[RequestParam] annotations not being processed before input filtering for services using the traditional processRequest() pattern (without #[ResponseBody]).

Motivation

Services that use #[RequestParam] annotations on processRequest() always receive null from getParamVal() because the annotations are never resolved before the filter runs. This only affects the processRequest() path — #[ResponseBody] services work correctly. Fixes #102.

Changes

  • Added a call to $actionObj->getParameterByName('',$this->getRequest()->getRequestMethod()) in WebServicesManager::process() before getParameters() is called. This triggers the lazy annotation resolution for the current HTTP method, ensuring #[RequestParam] parameters are registered in the filter for all services.
  • Added AnnotatedParamsLegacyService test service that uses #[RequestParam] with processRequest().
  • Added AnnotatedParamsProcessRequestTest with 6 test cases covering the fix and regression checks.

How to Test / Verify

Unit tests:

php vendor/bin/phpunit --configuration tests/phpunit10.xml --filter AnnotatedParamsProcessRequestTest

Full suite (422 tests, 0 failures):

php vendor/bin/phpunit --configuration tests/phpunit10.xml

Test cases:

  1. POST params are correctly received via processRequest() with #[RequestParam] annotations
  2. Missing required params are reported by the framework
  3. Partially missing params are reported
  4. #[ResponseBody] services still work (regression check)
  5. #[ResponseBody] services with no params still work (regression check)
  6. Wrong HTTP method is rejected

Breaking Changes and Migration Steps

None. This is a purely additive fix. The getParameterByName() call is a no-op when annotations have already been resolved (e.g., for #[ResponseBody] services), so existing behavior is unchanged.

Checklist

  • I reviewed my own diff before requesting review
  • My commits follow Conventional Commits
  • The title of the pull request follows Conventional Commits
  • I added/updated tests (or explained why not)
  • I updated docs (if needed)
  • I ran lint/cs-fixer (if applicable)
  • I considered backward compatibility
  • I considered security

Related issues

Closes #102

@usernane usernane merged commit 27aae18 into main May 3, 2026
6 checks passed
@codecov

codecov Bot commented May 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.12%. Comparing base (34ce8e8) to head (23ac100).
⚠️ Report is 10 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #103   +/-   ##
=========================================
  Coverage     92.12%   92.12%           
  Complexity     1268     1268           
=========================================
  Files            39       39           
  Lines          3049     3049           
=========================================
  Hits           2809     2809           
  Misses          240      240           
Flag Coverage Δ
php-8.1 91.89% <100.00%> (ø)
php-8.2 91.96% <100.00%> (ø)
php-8.3 91.96% <100.00%> (ø)
php-8.4 91.96% <100.00%> (ø)
php-8.5 91.96% <100.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.

@sonarqubecloud

sonarqubecloud Bot commented May 3, 2026

Copy link
Copy Markdown

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.

bug(WebServicesManager): #[RequestParam] annotations not resolved before filtering in processRequest() flow

1 participant