Skip to content

Bug: Validation permit_empty does no work together with required_with and required_without #2953

Description

@najdanovicivan

Describe the bug
I'm working on admin form for MythAuth where user password can be changed. The form also updated other user data. So requirement for changing password is to enter current password in cases where password is not being changed it should be possible to submit the form with empty current password so I have validation rules it the following format

'currentPassword'=>'permit_empty|required_with[newPassword]|valid_password[{id}]'

This makes validation pass when currentPassword is empty and newPassword is set which should not be possible

CodeIgniter 4 version
git - 85cd56a

Affected module(s)
Validation Library

Expected behaviour, and steps to reproduce if appropriate
If newPassword is not empty validation should not pass with empty currentPassword field.

Context

  • OS: MacOS 10.15.4
  • Web server Apache 2
  • PHP version 7.4.2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugVerified issues on the current code behavior or pull requests that will fix them

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions