Skip to content

Commit 65fcd80

Browse files
committed
Add info/warning for common issues encountered by users
1 parent fdc8983 commit 65fcd80

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/WebPush.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,26 @@ class WebPush
4545
*/
4646
public function __construct(array $auth = array(), $defaultOptions = array(), $timeout = 30, $clientOptions = array())
4747
{
48+
if (!extension_loaded('curl')) {
49+
trigger_error("[WebPush] curl extension is not loaded but is required. You can fix this in your php.ini.", E_USER_WARNING);
50+
}
51+
52+
if (!extension_loaded('gmp')) {
53+
trigger_error("[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.", E_USER_NOTICE);
54+
}
55+
56+
if (!extension_loaded('mbstring')) {
57+
trigger_error("[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.", E_USER_NOTICE);
58+
}
59+
60+
if (!extension_loaded('openssl')) {
61+
trigger_error("[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.", E_USER_NOTICE);
62+
}
63+
64+
if (ini_get('mbstring.func_overload') >= 2) {
65+
trigger_error("[WebPush] mbstring.func_overload is enabled for str* functions. You must disable it if you want to send push notifications with payload or use VAPID. You can fix this in your php.ini.", E_USER_NOTICE);
66+
}
67+
4868
if (array_key_exists('VAPID', $auth)) {
4969
$auth['VAPID'] = VAPID::validate($auth['VAPID']);
5070
}

0 commit comments

Comments
 (0)