Skip to content

fix: nested transformer request scope leakage#10281

Open
michalsn wants to merge 2 commits into
codeigniter4:developfrom
michalsn:fix/transformer-nested-state-leakage
Open

fix: nested transformer request scope leakage#10281
michalsn wants to merge 2 commits into
codeigniter4:developfrom
michalsn:fix/transformer-nested-state-leakage

Conversation

@michalsn
Copy link
Copy Markdown
Member

@michalsn michalsn commented Jun 5, 2026

Description
This PR fixes a bug where nested transformers created inside include*() methods could inherit the root request's fields and include query parameters.

Bare nested transformers now skip the root request scope, while root transformers and explicitly passed requests keep their existing behavior.

Ref: #10278

Checklist:

  • Securely signed commits
  • Component(s) with PHPDoc blocks, only if necessary or adds value (without duplication)
  • Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@michalsn michalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 5, 2026
Copy link
Copy Markdown
Contributor

@datamweb datamweb left a comment

Choose a reason for hiding this comment

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

This looks like an elegant bug fix with excellent foresight. Thanks!

throw ApiException::forMissingInclude($include);
self::$depth++;

try {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I really liked the use of try block!

@michalsn michalsn requested a review from paulbalandan June 6, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Verified issues on the current code behavior or pull requests that will fix them

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants