Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions app/code/Magento/Customer/Model/Validator/Telephone.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Telephone extends AbstractValidator
* \d: Digits (0-9).
*/
private const PATTERN_TELEPHONE = '/(?:[\d\s\+\-\()]{1,20})/u';

/**
* Validate telephone fields.
*
Expand All @@ -50,12 +50,10 @@ public function isValid($customer)
*/
private function isValidTelephone($telephoneValue)
{
if ($telephoneValue != null) {
if (preg_match(self::PATTERN_TELEPHONE, (string) $telephoneValue, $matches)) {
return $matches[0] == $telephoneValue;
}
if ($telephoneValue === null) {
return true;
}

return true;
return (bool) preg_match(self::PATTERN_TELEPHONE, (string) $telephoneValue);
}
}