Skip to content

Commit 4597a3a

Browse files
committed
fix > PHP5.5.9 without jose
1 parent becdea3 commit 4597a3a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/WebPush.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function __construct(array $apiKeys = array(), $TTL = 2419200, $timeout =
6262
$client->setTimeout($timeout);
6363
$this->browser = new Browser($client);
6464

65-
$this->payloadEncryptionSupport = version_compare(phpversion(), '5.5.9', '>=');
65+
$this->payloadEncryptionSupport = version_compare(phpversion(), '5.5.9', '>=') && class_exists("\\Jose\\Util\\GCM");
6666
$this->nativePayloadEncryptionSupport = version_compare(phpversion(), '7.1', '>=');
6767
}
6868

@@ -220,7 +220,7 @@ private function sendToStandardEndpoints(array $notifications)
220220
$payload = $notification->getPayload();
221221
$userPublicKey = $notification->getUserPublicKey();
222222

223-
if (isset($payload) && isset($userPublicKey) && $this->payloadEncryptionSupport) {
223+
if (isset($payload) && isset($userPublicKey) && ($this->payloadEncryptionSupport || $this->nativePayloadEncryptionSupport)) {
224224
$encrypted = $this->encrypt($userPublicKey, $payload);
225225

226226
$headers = array(

0 commit comments

Comments
 (0)