Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 8620e82

Browse filesBrowse files
author
Vasilij Dusko | CREATION
committed
* LightSmsTransport.php - move timestamp
1 parent 66c34ba commit 8620e82
Copy full SHA for 8620e82

File tree

1 file changed

+9
-6
lines changed
Filter options

1 file changed

+9
-6
lines changed

‎src/Symfony/Component/Notifier/Bridge/LightSms/LightSmsTransport.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Notifier/Bridge/LightSms/LightSmsTransport.php
+9-6Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,10 @@ protected function doSend(MessageInterface $message): SentMessage
9999
throw new UnsupportedMessageTypeException(__CLASS__, SmsMessage::class, $message);
100100
}
101101

102-
$signature = $this->generateSignature($message);
102+
$signature = $this->generateSignature([
103+
'message' => $message,
104+
'timestamp' => time(),
105+
]);
103106

104107
$endpoint = sprintf(
105108
'https://%s/external/get/send.php?login=%s&signature=%s&phone=%s&text=%s&sender=%s&timestamp=%s',
@@ -121,7 +124,7 @@ protected function doSend(MessageInterface $message): SentMessage
121124
}
122125

123126
$phone = preg_replace("/[^\d]/", '', $message->getPhone());
124-
if (32 == $content[$phone]['error']) {
127+
if (32 === $content[$phone]['error']) {
125128
throw new TransportException('Unable to send the SMS: '.self::ERROR_CODES[$content['error']], $response);
126129
}
127130

@@ -133,14 +136,14 @@ protected function doSend(MessageInterface $message): SentMessage
133136
return $sentMessage;
134137
}
135138

136-
private function generateSignature(SmsMessage $message): string
139+
private function generateSignature(array $params): string
137140
{
138141
$params = [
139-
'timestamp' => time(),
142+
'timestamp' => $params['timestamp'],
140143
'login' => $this->login,
141-
'phone' => str_replace('+', '', $message->getPhone()),
144+
'phone' => str_replace('+', '', $params['message']->getPhone()),
142145
'sender' => $this->phone,
143-
'text' => $message->getSubject(),
146+
'text' => $params['message']->getSubject(),
144147
];
145148

146149
ksort($params);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.