zendframework / ZendService_Apple_Apns

BSD 3-Clause "New" or "Revised" License
49 stars 70 forks source link

Always include 'aps' key #49

Closed hipsterjazzbo closed 6 years ago

hipsterjazzbo commented 8 years ago

In #18, a change was made to exclude the aps key if it is empty. This causes totally empty notifications to fail (for example, when pushing to an Apple Wallet pass to trigger an update). The correct behavior to would be to include the empty aps key encoded as a JSON object, like this:

{
    "aps": {}
}

This PR fixes this by always including the "aps" key and casting $aps to an object, so that in the event it is empty it will be correctly encoded as an empty JSON object, rather that an empty JSON array as mentioned in #18.

Reference:

For each notification, compose a JSON dictionary object (as defined by RFC 4627). This dictionary must contain another dictionary identified by the aps key.

weierophinney commented 6 years ago

Thanks, @HipsterJazzbo; merged to develop for release with 1.3.0