* LightSmsTransport.php - changed login for validation (the same like we have all places)

This commit is contained in:
Vasilij Dusko | CREATION 2021-03-29 13:34:15 +03:00
parent 5d2e6928f3
commit fc13bb27e2

View File

@ -123,7 +123,7 @@ final class LightSmsTransport extends AbstractTransport
throw new TransportException('Unable to send the SMS: '.self::ERROR_CODES[$content['error']], $response); throw new TransportException('Unable to send the SMS: '.self::ERROR_CODES[$content['error']], $response);
} }
$phone = preg_replace("/[^\d]/", '', $message->getPhone()); $phone = $this->escapePhoneNumber($message->getPhone());
if (32 === $content[$phone]['error']) { if (32 === $content[$phone]['error']) {
throw new TransportException('Unable to send the SMS: '.self::ERROR_CODES[$content['error']], $response); throw new TransportException('Unable to send the SMS: '.self::ERROR_CODES[$content['error']], $response);
} }
@ -159,6 +159,6 @@ final class LightSmsTransport extends AbstractTransport
private function escapePhoneNumber($phoneNumber): string private function escapePhoneNumber($phoneNumber): string
{ {
return str_replace('+', '', $phoneNumber); return preg_replace("/[^\d]/", '', $phoneNumber);
} }
} }