Skip to content

Bug: Redundant logic in PasswordEncryption condition (CustomerExtension.php) #413

@jsirish

Description

@jsirish

Description

In src/ORM/CustomerExtension.php around line 53, the condition:

if (!$this->owner->PasswordEncryption && ($this->owner->PasswordEncryption == null || $this->owner->PasswordEncryption == 'none'))

is logically redundant. The !$this->owner->PasswordEncryption on the left of && already ensures the value is falsy, making the inner || conditions unreachable/redundant.

More importantly, the logic may be inverted — if PasswordEncryption is truthy (e.g., already set to a valid encryption like blowfish), the entire condition is false and it won't execute. The intended behavior is likely:

if (!$this->owner->PasswordEncryption || $this->owner->PasswordEncryption == 'none')

i.e., "if the PasswordEncryption is not set OR it equals 'none', then set it to sha1_v2.4."

Additional Note

There's also a typo in the comment on line 48: sh1_v2.4 should be sha1_v2.4.

Discovered during Copilot review of PR #412.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions