-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Validation: wildcard symbol to match any one level of the array not working correctly #5286
Comments
jahmedk
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Nov 5, 2021
Can't reproduce on the latest
public function test_5286(): void
{
$rules = [
'arl1.*.id' => 'required|regex_match[/^[0-9]+$/]',
'arl1.*.alpha' => 'required|regex_match[/^[?a-zA-Z ]+$/]',
];
$data = [
'arl1' => [
[
'id' => 101,
'alpha' => 'Simple String',
],
[
'id' => '#10003',
'alpha' => 'Simple & Symbol',
],
],
];
$actual = $this->validation->setRules($rules)->run($data);
d($actual);
dd($this->validation->getErrors());
} $ ./phpunit tests/system/Validation/ValidationTest.php --filter=test_5286
PHPUnit 9.5.10 by Sebastian Bergmann and contributors.
Runtime: PHP 8.0.12
Configuration: /Users/kenji/work/codeigniter/CodeIgniter4/phpunit.xml
┌─────────────────────────────────────────────────────────────────────────────────────────────────┐
│ $actual │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
boolean false
═══════════════════════════════════════════════════════════════════════════════════════════════════
Called from <ROOT>/tests/system/Validation/ValidationTest.php:1032 [d()]
┌─────────────────────────────────────────────────────────────────────────────────────────────────┐
│ $this->validation->getErrors() │
└─────────────────────────────────────────────────────────────────────────────────────────────────┘
array (2) [
'arl1.*.id' => string (49) "The arl1.*.id field is not in the correct format."
'arl1.*.alpha' => string (52) "The arl1.*.alpha field is not in the correct format."
]
═══════════════════════════════════════════════════════════════════════════════════════════════════
Called from <ROOT>/tests/system/Validation/ValidationTest.php:1033 [dd()] |
kenjis
changed the title
wildcard symbol to match any one level of the array not working correctly
Validattion: wildcard symbol to match any one level of the array not working correctly
Nov 5, 2021
kenjis
changed the title
Validattion: wildcard symbol to match any one level of the array not working correctly
Validation: wildcard symbol to match any one level of the array not working correctly
Nov 5, 2021
kenjis
removed
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Nov 5, 2021
Hi yes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PHP Version
7.3
CodeIgniter4 Version
4.0.5
Which operating systems have you tested for this bug?
Windows
Which server did you use?
apache
Database
mysql
What happened?
One level array validating just 0 index but it's not working on multiple records.
Steps to Reproduce
Expected Output
$validation->run($aVars) must be false if array contain invalid data
Anything else?
No response
The text was updated successfully, but these errors were encountered: