-
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
Bug: validation level dont work as expected #9022
Comments
Thank you for reporting. Please use the following format in the future. ```php // PHP code ``` |
In your sample data, there is no $body = '{"cards": [{"fields": {"name": "name"}}]}';
$data = json_decode($body, true);
var_dump(array_flatten_with_dots($data));
|
so I can't validate that key "fields" exists? here is my data dumped with var_dump: array(1) {
["cards"]=>
array(1) {
[0]=>
array(1) {
["fields"]=>
array(1) {
["name"]=>
string(5) "value"
}
}
}
} it seems to me that it should be possible to add a rule that checks whether the key "fields" exists or not. |
The data is:
If all data is like that, you can write the validation rule:
You can use the rule |
I edited my previous comment, yes it fixes my problem. |
PHP Version
8.3
CodeIgniter4 Version
5.0.2
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
Linux
Which server did you use?
fpm-fcgi
Database
MariaDB 10.6.18
What happened?
Validation does not work at higher levels of the array
look at the screenshot of my rules:
here is my request:
and here is validation:
Steps to Reproduce
create rules, eg:
create json body for request:
write validate code:
Expected Output
Validation should not show an error. Unless there are no "fields"
Anything else?
thanks.
The text was updated successfully, but these errors were encountered: