Fixed Push notification classes: errors after PHP 8.0 upgrade


Well-known member

See lots of these errors in logs.
Any ideas?


ErrorException: Fatal Error: Declaration of XF\Service\Alert\Pusher::setInitialProperties(XF\Entity\UserAlert $alert) must be compatible with XF\Service\PusherTrait::setInitialProperties(...$properties) src/XF/Service/Alert/Pusher.php:33

#0 [internal function]: XF::handleFatalError()
#1 {main}
Request state
array(4) {
  ["url"] => string(21) "/konu/99434/add-reply"
  ["referrer"] => string(32) "https://x/konu/99434/"
  ["_GET"] => array(0) {
  ["_POST"] => array(10) {
    ["message_html"] => string(1007) "x"
    ["attachment_hash"] => string(32) "cd8cca491bfea9b3a5801bfe1c5c3133"
    ["attachment_hash_combined"] => string(87) "{"type":"post","context":{"thread_id":99434},"hash":"cd8cca491bfea9b3a5801bfe1c5c3133"}"
    ["last_date"] => string(10) "1606986870"
    ["last_known_date"] => string(10) "1606986413"
    ["load_extra"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(12) "/konu/99434/"
    ["_xfWithData"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"


Well-known member
src/XF/Service/PusherTrait.php: $this->setInitialProperties(...$properties);
src/XF/Service/PusherTrait.php: abstract protected function setInitialProperties(...$properties);
src/XF/Service/Alert/Pusher.php:        protected function setInitialProperties(UserAlert $alert)
src/XF/Service/Conversation/Pusher.php: protected function setInitialProperties(ConversationMessage $message, $actionType, \XF\Entity\User $sender)
Not sure what the fix should be.
Last edited:


XenForo developer
Staff member
I'm going to move this to bugs as we will have to change something here, though I'm not sure the best approach.

This approach didn't throw errors in traits in PHP7 (though it did in classes), so there's a specific change here.

I think as a temporary workaround, you may be able to remove this line from src/XF/Service/PusherTrait.php:

abstract protected function setInitialProperties(...$properties);
Last edited:

XF Bug Bot

XenForo bug fixer bot
Staff member
Thank you for reporting this issue, it has now been resolved. We are aiming to include any changes that have been made in a future XF release (2.2.3).

Change log:
Fix PHP 8 compatibility issue relating to push notifications.
There may be a delay before changes are rolled out to the XenForo Community.

Gene Steinberg

Well-known member
Our experience with PHP 8.0 with three forums indicates that the Push Notification option is the only one failing so far. Disabling it means that all run just perfect so far. Since I use macOS Safari and iOS, Push isn't helpful anyway, and it doesn't seem our members care.