Bug: valid_email is not working with permit_empty rules
PHP Version
8.2
CodeIgniter4 Version
4.5.2
CodeIgniter4 Installation Method
Composer (using codeigniter4/appstarter)
Which operating systems have you tested for this bug?
Windows
Which server did you use?
cli-server (PHP built-in webserver)
Database
MySql
What happened?
I have set valid_email and permit_empty validation rule in my email. But it not validating email when email field has invalid email format data.
Steps to Reproduce
Add a validation rule in email field valid_email|permit_empty It is not validating the email when email field has data.
Expected Output
I want to validating the email field only when user fill the email field.
Anything else?
No response
Can you show sample code to reproduce?
CI 4.5.4 works. Errors is empty or show "The email field must contain a valid email address":
$this->validateData(
[
// 'email' => 'test@mail',
// 'email' => '',
],
[
'email' => 'valid_email|permit_empty',
]
);
var_dump(
'Debug: ',
$this->validator->getErrors()
);
No response. Closing