Skip to content
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

fix: [Validation] if_exist does not work with array data #8959

Merged
merged 3 commits into from
Jun 19, 2024

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jun 12, 2024

Description
Fixes #8956

Fixed the bug that If an array is passed, Validation with if_exist rule always returns true.

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 the bug Verified issues on the current code behavior or pull requests that will fix them label Jun 12, 2024
Comment on lines 32 to 35
if (is_array($str)) {
return false;
}

Copy link
Member

Choose a reason for hiding this comment

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

Why is this check only added here? Shouldn't it also be in other rules?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because there was an error when running phpunit.
But changing alpha is not good.

The Traditional Rules should not be changed as much as possible.
So I reverted it and changed the test code.

Traditional Rules exist only for backward compatibility. Do not use them in new projects. Even if you are already using them, we recommend switching to Strict Rules.
https://codeigniter4.github.io/CodeIgniter4/libraries/validation.html#traditional-rules

@kenjis kenjis merged commit 2fae945 into codeigniter4:develop Jun 19, 2024
41 checks passed
@kenjis kenjis deleted the fix-if_exist-with-array branch June 19, 2024 02:15
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.

Bug: [Validation] if_exist is not working as intended with arrays
2 participants