Skip to content

fix: [Filters] normalize $filters arguments #8994

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jun 29, 2024

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 24, 2024

Description
This PR normalizes $filters arguments.
Because Route filter's arguments are already normalized (trimmed).

[$name, $arguments] = $this->getCleanName($name);

private function getCleanName(string $name): array
{
$arguments = [];
if (str_contains($name, ':')) {
[$name, $arguments] = explode(':', $name);
$arguments = explode(',', $arguments);
array_walk($arguments, static function (&$item) {
$item = trim($item);
});
}
return [$name, $arguments];
}

  • normalize $filters arguments
  • refactor

Checklist:

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

@kenjis kenjis added enhancement PRs that improve existing functionalities 4.6 bug Verified issues on the current code behavior or pull requests that will fix them and removed enhancement PRs that improve existing functionalities labels Jun 24, 2024
@kenjis kenjis changed the title feat: [Filter] normalize $filters arguments fix: [Filter] normalize $filters arguments Jun 24, 2024
@kenjis kenjis force-pushed the normalizer-filters-filter-args branch from 3317bda to bdfe019 Compare June 24, 2024 02:14
@kenjis kenjis changed the title fix: [Filter] normalize $filters arguments fix: [Filters] normalize $filters arguments Jun 24, 2024
kenjis added 2 commits June 27, 2024 10:39
For consistency. Route filter arguments are already normalized.
@kenjis kenjis force-pushed the normalizer-filters-filter-args branch from bdfe019 to 81efd57 Compare June 27, 2024 01:42
@kenjis kenjis force-pushed the normalizer-filters-filter-args branch from 81efd57 to f3e5504 Compare June 27, 2024 04:55
@kenjis kenjis merged commit 85434df into codeigniter4:4.6 Jun 29, 2024
41 checks passed
@kenjis kenjis deleted the normalizer-filters-filter-args branch June 29, 2024 01:09
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.

4 participants