Skip to content

fix(Filters): check both keys and values in InvalidChars arrays - #10303

Merged
paulbalandan merged 5 commits into
codeigniter4:developfrom
gr8man:fix/invalid-chars-array-map
Jun 14, 2026
Merged

fix(Filters): check both keys and values in InvalidChars arrays#10303
paulbalandan merged 5 commits into
codeigniter4:developfrom
gr8man:fix/invalid-chars-array-map

Conversation

@gr8man

Copy link
Copy Markdown
Contributor

This PR fixes a bug in the InvalidChars filter where array keys were not being validated.
Previously, checkControl() used array_map(), which only applied the callback to the array's values while ignoring the array's keys entirely. Due to this, any control characters or invalid UTF-8 sequences passed through array keys (e.g. $_POST['bad_key']) bypassed the filter.

@michalsnmichalsn left a comment

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.

Please add a changelog entry.

@michalsnmichalsn added the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 12, 2026
@michalsn

Copy link
Copy Markdown
Member

@gr8man
gr8man requested a review from michalsnJune 13, 2026 18:16

@michalsnmichalsn left a comment

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.

Thank you.

@paulbalandanpaulbalandan changed the title fix(Filters): check both keys and values in InvalidChars arraysfix(Filters): check both keys and values in InvalidChars arraysJun 14, 2026
@paulbalandan
paulbalandan merged commit 56bace9 into codeigniter4:developJun 14, 2026
57 checks passed
@paulbalandan

Copy link
Copy Markdown
Member

Thank you, @gr8man

maniaba pushed a commit to maniaba/CodeIgniter4 that referenced this pull request Jun 17, 2026
…deigniter4#10303)
* fix(Filters): check both keys and values in InvalidChars arrays
* test(Filters): use DataProvider for InvalidChars control characters test
* style: fix PHPStan iterable return type in tests
* chore: re-trigger CI
* docs: update changelog for InvalidChars array keys fix
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugVerified 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.

3 participants

@gr8man@michalsn@paulbalandan