-
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 on null for trim #7067
Comments
Sorry, I don't get what you say. Why do you use Can you show exact Steps to Reproduce? |
If you still think this is a bug, feel free to reopen. |
I have the same issue, when you post an empty value on a form validation where you specified trim it results into: "message": "trim(): Passing null to parameter #1 ($string) of type string is deprecated", |
If you specify |
Cannot reproduce.
|
PHP Version
8.1
CodeIgniter4 Version
4.2.5
CodeIgniter4 Installation Method
Composer (using
codeigniter4/appstarter
)Which operating systems have you tested for this bug?
macOS
Which server did you use?
apache
Database
No response
What happened?
trim() on null is not working for validation.
I suggest to edit: Validation.php Line 302:
$passed = $param === false ? $rule((string) $value ?? '') : $rule((string) $value ?? '', $param, $data);
Steps to Reproduce
make rule without a post.
Expected Output
Expected:\
Previous:
$passed = $param === false ? $rule($value) : $rule($value, $param, $data);
$passed = $param === false ? $rule((string) $value ?? '') : $rule((string) $value ?? '', $param, $data);
Anything else?
No response
The text was updated successfully, but these errors were encountered: