Closed
Closed
Copy link
Description
Symfony version(s) affected: 5.3.3
Description
When sending a push message to a unregistered device. This error pops up.
Notice: Undefined index: message_id at /vendor/symfony/firebase-notifier/FirebaseTransport.php:92
I am using a valid device token except it is not registered anymore. This can happen when uninstalling the app it belongs to.
More info on Firebase error codes: https://firebase.google.com/docs/cloud-messaging/xmpp-server-ref.html#error-codes
How to reproduce
Try sending a push message to a "NotRegistered" Firebase device token.
Possible Solution
The FirebaseTransport
checks if the Firebase API response by doing:
if ($jsonContents && isset($jsonContents['results']['error'])) {
throw new TransportException('Unable to post the Firebase message: '.$jsonContents['error'], $response);
}
In my opinion this should be:
if ($jsonContents && isset($jsonContents['results'][0]['error'])) {
throw new TransportException('Unable to post the Firebase message: '.$jsonContents['results'][0]['error'], $response);
}