Not a bug ErrorException: [E_USER_WARNING] [WebPush] gmp extension is not loaded but is required for sending push notifications

Fethi.dz

Well-known member
Affected version
xF2.1 Beta 4
Hello,

Push notifications when are not supported should be completely OFF but am getting this error on any activity on my testing forum. (iPhone iOS 12.1 / Safari)

Server error log
Code:
ErrorException: [E_USER_WARNING] [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. src\vendor\minishlink\web-push\src\WebPush.php:72
Generated by: Test2 Nov 30, 2018 at 5:52 AM

Stack trace
Code:
#0 [internal function]: XF::handlePhpError(512, '[E_USER_WARNING...', 'C:\\xampp\\htdocs...', 72, Array)
#1 src\vendor\minishlink\web-push\src\WebPush.php(72): trigger_error('[WebPush] gmp e...', 512)
#2 src\XF\Service\PushNotification.php(265): Minishlink\WebPush\WebPush->__construct(Array, Array, 10, Array)
#3 src\XF\Service\PushNotification.php(127): XF\Service\PushNotification->getWebPushObject()
#4 src\XF\Service\PusherTrait.php(64): XF\Service\PushNotification->sendNotifications()
#5 src\XF\Repository\UserAlert.php(147): XF\Service\Alert\Pusher->push()
#6 src\XF\Repository\UserAlert.php(98): XF\Repository\UserAlert->insertAlert(1, 3, 'Test2', 'post', 67, 'reaction', Array)
#7 src\XF\Reaction\AbstractHandler.php(175): XF\Repository\UserAlert->alertFromUser(Object(XF\Entity\User), Object(XF\Entity\User), 'post', 67, 'reaction', Array)
#8 src\XF\Repository\Reaction.php(196): XF\Reaction\AbstractHandler->sendReactionAlert(Object(XF\Entity\User), Object(XF\Entity\User), 67, Object(XF\Entity\Post), 1)
#9 src\XF\Repository\Reaction.php(137): XF\Repository\Reaction->insertReaction(1, 'post', 67, Object(XF\Entity\User), true, false)
#10 src\XF\ControllerPlugin\Reaction.php(65): XF\Repository\Reaction->reactToContent(1, 'post', 67, Object(XF\Entity\User), true)
#11 src\XF\ControllerPlugin\Reaction.php(19): XF\ControllerPlugin\Reaction->actionToggleReaction(Object(XF\Entity\Post), 'posts/reactions', 'posts')
#12 src\XF\ControllerPlugin\Reaction.php(12): XF\ControllerPlugin\Reaction->actionReact(Object(XF\Entity\Post), 'posts', 'posts/react', 'posts/reactions')
#13 src\XF\Pub\Controller\Post.php(351): XF\ControllerPlugin\Reaction->actionReactSimple(Object(XF\Entity\Post), 'posts')
#14 src\XF\Mvc\Dispatcher.php(321): XF\Pub\Controller\Post->actionReact(Object(XF\Mvc\ParameterBag))
#15 src\XF\Mvc\Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XF:Post', 'React', Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Post), NULL)
#16 src\XF\Mvc\Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XF\Pub\Controller\Post), NULL)
#17 src\XF\Mvc\Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#18 src\XF\App.php(2170): XF\Mvc\Dispatcher->run()
#19 src\XF.php(392): XF\App->run()
#20 index.php(20): XF::runApp('XF\\Pub\\App')
#21 {main}
 
We already have code which should prevent sending the notifications before it gets to this stage in the code:
PHP:
public function isPushAvailable()
{
   $options = $this->app->options();

   return (
      $options->enablePush
      && $options->pushKeysVAPID['publicKey']
      && $options->pushKeysVAPID['privateKey']
      && $this->isReceiverSubscribed()
   );
}

So that would imply that you have push enabled, here:
189441

Or when you get to that option, do you see the option is greyed out and a red error message? Was it enabled previously? There was a bug previously which would have allowed you to enable the option even if your server didn't support it, but that is fixed now.

You may just need to verify that the option is disabled and then hit "Save" to ensure that overwrites the previous enabled state.
 
I suspect you enabled it in Beta 2 actually (we pretty much released Beta 3 and 4 within an hour of each other and we fixed it before releasing Beta 3).

But that's ultimately what the bug was. You should never have been able to enable it in the first place.

Just hit "Save" on that page and the error will go away. Either that, or get your host to enable the gmp extension :)
 
Top Bottom