mac-cain13 / notificato

Takes care of Apple push notifications (APNS) in your PHP projects.
MIT License
224 stars 44 forks source link

"Call to a member function setStatus() on a non-object" in Gateway.php #37

Closed eXtreme closed 11 years ago

eXtreme commented 11 years ago

PHP Fatal error: Call to a member function setStatus() on a non-object in /var/www/sfbackend/releases/20131030144915/vendor/wrep/notificato/src/Wrep/Notificato/Apns/Gateway.php on line 192

I sometimes get this error. Not sure about it origins but it makes sense because method retrieveMessageEnvelope can return null while on line 192 we have setStatus() call on that return value.

mac-cain13 commented 11 years ago

Interesting error! Thanks for using Notificato and reporting this issue.

I've looked somewhat into this and it seems that your observation is correct. Looks like Apple is returning an identifier that isn't present in the array with messages anymore. How many push messages are you sending at once when this occurs? More than 50 at once or in a very short time window?

I'll build in a check so we don't crash on a null and store somewhat more messages in the backlog so this shouldn't occur anymore.

Looking forward to hear from you! And thanks for reporting this issue once again.

eXtreme commented 11 years ago

Well we often send even a 10k notifications.

mac-cain13 commented 11 years ago

Good to know, that should explain the issues. I've just released 1.0.3 with the null issue fixed! Let me know if it works for you!

eXtreme commented 11 years ago

Thanks, I will update my code and see how it goes

eXtreme commented 11 years ago

Seems to be working good so far

mac-cain13 commented 11 years ago

Great to hear it looks good so far! Thanks for the feedback.