From 6fc8c01c92e7d46ef2ad8116bd0be26beb6df992 Mon Sep 17 00:00:00 2001 From: Anderson Ivan Witzke <4406761+ivanwitzke@users.noreply.github.com> Date: Sun, 13 Feb 2022 11:47:18 -0300 Subject: [PATCH] Checks PHP version bebore requiring GMP (#346) Fixes #316 --- src/WebPush.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/WebPush.php b/src/WebPush.php index 54b6b23..ef36f46 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);