Skip to content

Commit

Permalink
Checks PHP version bebore requiring GMP (#346)
Browse files Browse the repository at this point in the history
Fixes #316
  • Loading branch information
ivanwitzke authored Feb 13, 2022
1 parent 199c83e commit 6fc8c01
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/WebPush.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 6fc8c01

Please sign in to comment.