XF 2.1 Push notification server error

tommydamic68

Well-known member
Sorry if this is not correct, just saw push in the error code and thought it may be a bug, I had 2 of these server errors in my ACP this morning.

Code:
ParseError: syntax error, unexpected 'const' (T_CONST), expecting variable (T_VARIABLE) src/vendor/minishlink/web-push/src/WebPush.php:24
Generated by: Yoda mom Feb 27, 2019 at 11:19 PM
Stack trace
#0 src/vendor/composer/ClassLoader.php(322): Composer\Autoload\includeFile('/home/admin/pub...')
#1 [internal function]: Composer\Autoload\ClassLoader->loadClass('Minishlink\\WebP...')
#2 src/XF/Service/PushNotification.php(274): spl_autoload_call('Minishlink\\WebP...')
#3 src/XF/Service/PushNotification.php(127): XF\Service\PushNotification->getWebPushObject()
#4 src/XF/Service/PusherTrait.php(87): XF\Service\PushNotification->sendNotifications()
#5 src/XF/Repository/UserAlert.php(147): XF\Service\Alert\Pusher->push()
#6 src/XF/Repository/UserAlert.php(111): XF\Repository\UserAlert->insertAlert(14334, 4352, 'Yoda mom', 'xfmg_comment', 10194, 'insert', Array)
#7 src/XF/Notifier/AbstractNotifier.php(55): XF\Repository\UserAlert->alert(Object(XFMG\XF\Entity\User), 4352, 'Yoda mom', 'xfmg_comment', 10194, 'insert', Array)
#8 src/addons/XFMG/Notifier/Comment/MediaWatch.php(43): XF\Notifier\AbstractNotifier->basicAlert(Object(XFMG\XF\Entity\User), 4352, 'Yoda mom', 'xfmg_comment', 10194, 'insert')
#9 src/XF/Service/AbstractNotifier.php(86): XFMG\Notifier\Comment\MediaWatch->sendAlert(Object(XFMG\XF\Entity\User))
#10 src/XF/Service/AbstractNotifier.php(44): XF\Service\AbstractNotifier->notifyType(Object(XFMG\Notifier\Comment\MediaWatch), Array, G)
#11 src/XF/Service/AbstractNotifier.php(56): XF\Service\AbstractNotifier->notify(3)
#12 src/addons/XFMG/Service/Comment/Creator.php(136): XF\Service\AbstractNotifier->notifyAndEnqueue(3)
#13 src/addons/XFMG/Pub/Controller/AbstractComment.php(123): XFMG\Service\Comment\Creator->sendNotifications()
#14 src/addons/XFMG/Pub/Controller/AbstractComment.php(212): XFMG\Pub\Controller\AbstractComment->finalizeCommentCreate(Object(XFMG\Service\Comment\Creator))
#15 src/XF/Mvc/Dispatcher.php(321): XFMG\Pub\Controller\AbstractComment->actionAddComment(Object(XF\Mvc\ParameterBag))
#16 src/XF/Mvc/Dispatcher.php(248): XF\Mvc\Dispatcher->dispatchClass('XFMG:MediaComme...', 'AddComment', Object(XF\Mvc\RouteMatch), Object(XFMG\Pub\Controller\MediaComment), NULL)
#17 src/XF/Mvc/Dispatcher.php(100): XF\Mvc\Dispatcher->dispatchFromMatch(Object(XF\Mvc\RouteMatch), Object(XFMG\Pub\Controller\MediaComment), NULL)
#18 src/XF/Mvc/Dispatcher.php(50): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#19 src/XF/App.php(2177): XF\Mvc\Dispatcher->run()
#20 src/XF.php(390): XF\App->run()
#21 index.php(20): XF::runApp('XF\\Pub\\App')
#22 {main}
Request state
array(4) {
  ["url"] => string(77) "/community/media/media-comments/img_20190221_050051_067-jpg.29505/add-comment"
  ["referrer"] => string(73) "https://sphynxlair.com/community/media/img_20190221_050051_067-jpg.29505/"
  ["_GET"] => array(0) {
  }
  ["_POST"] => array(7) {
    ["message_html"] => string(29) "<p>I looove my blankie :)</p>"
    ["last_date"] => string(10) "1550805926"
    ["last_known_date"] => string(1) "0"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(51) "/community/media/img_20190221_050051_067-jpg.29505/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
 
This error suggests you are not actually using PHP 7.2 or PHP 7.1 (PHP 7.1 is the minimum required for the push notification system).

PHP 7.1/7.2 would have been available when you enabled push notifications, but it doesn't appear to be now.

If you go to the homepage of your Admin CP, what version does the "Server environment report" say you are running?
 
It looks like the error was logged 12 hours ago. Were any changes being made on the server at that point, related to the server, such as upgrading things like PHP?

Have you continued to get these errors, or are push notifications being delivered successfully at the moment?

It is only possible to get the error you got if at that point a PHP version less than 7.1 was executing the scripts so that must be what happened, I'm just trying to understand what could cause that.
 
It looks like the error was logged 12 hours ago. Were any changes being made on the server at that point, related to the server, such as upgrading things like PHP?

Have you continued to get these errors, or are push notifications being delivered successfully at the moment?

It is only possible to get the error you got if at that point a PHP version less than 7.1 was executing the scripts so that must be what happened, I'm just trying to understand what could cause that.
I have not changed anything- sorry, I have all
Apple products do not sure if the push notifications work. I haven’t had a complaint. I had just 2 server errors in the ACP.
 
Sorry but at the point that error was logged, that was executed with a different PHP version than you have installed now. There’s no other explanation for it.

If it wasn’t you that made that change then you will need to consult with your host.

If no further errors have been logged then it is safe to ignore for now.
 
Top Bottom