From 015e4434fb2956d59a937c12f75708c4e7f89411 Mon Sep 17 00:00:00 2001 From: Anderson Ivan Witzke <4406761+ivanwitzke@users.noreply.github.com> Date: Thu, 30 Dec 2021 10:03:58 -0300 Subject: [PATCH] Checks PHP version bebore requiring GMP Fixes #316 --- src/WebPush.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/WebPush.php b/src/WebPush.php index 2db99d9..c89afde 100644 --- a/src/WebPush.php +++ b/src/WebPush.php @@ -69,10 +69,12 @@ public function __construct(array $auth = [], array $defaultOptions = [], ?int $ { $extensions = [ 'curl' => '[WebPush] curl extension is not loaded but is required. You can fix this in your php.ini.', - 'gmp' => '[WebPush] gmp extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.', 'mbstring' => '[WebPush] mbstring extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.', 'openssl' => '[WebPush] openssl extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.', ]; + if (version_compare(phpversion(), '7.3.0', '<')) { + $extensions['gmp'] = '[WebPush] gmp extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.'; + } foreach ($extensions as $extension => $message) { if (!extension_loaded($extension)) { trigger_error($message, E_USER_WARNING);