plokko/firebase-php

Request->submit

Closed this issue · 3 comments

Should the following code for the submit method

return ($json && isset($json['message']['name']))?$json['message']['name']:null;

not be

return ($json && isset($json['name']))?$json['name']:null;

As the message object doesn't exist it's just returning null.

@plokko Yes, that's true. I've just dumped the $json variable and it contains an array with "name" key.
Is this a bug or I with @ScoobyCoo are missing something?

Also, maybe we should remove echo in the request? This seems like debug-like thing and forces to use text buffering

The echo seem a leftover from debugging;
by the way i looked on the documentation and it seems you are correct:
the response should be a Message object without "wrapping" like when it's sended.
https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send#response-body

I'll fix ASAP, thanks.

Fixed