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

Bug: valid_email is not working with permit_empty rules #9092

Open
pranaycb opened this issue Jul 31, 2024 · 2 comments
Open

Bug: valid_email is not working with permit_empty rules #9092

pranaycb opened this issue Jul 31, 2024 · 2 comments
Labels
waiting for info Issues or pull requests that need further clarification from the author

Comments

@pranaycb
Copy link

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

@pranaycb pranaycb added the bug Verified issues on the current code behavior or pull requests that will fix them label Jul 31, 2024
@kenjis
Copy link
Member

kenjis commented Jul 31, 2024

Can you show sample code to reproduce?

@kenjis kenjis added the waiting for info Issues or pull requests that need further clarification from the author label Aug 1, 2024
@neznaika0
Copy link
Contributor

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()
        );

@kenjis kenjis removed the bug Verified issues on the current code behavior or pull requests that will fix them label Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for info Issues or pull requests that need further clarification from the author
Projects
None yet
Development

No branches or pull requests

3 participants