@@ -257,7 +257,7 @@ class Zend_Mobile_Push_Message_Gcm extends Zend_Mobile_Push_Message_Abstract
$json['registration_ids'] = $this->_token;
}
if ($this->_id) {
- $json['collapse_key'] = $this->_id;
+ $json['collapse_key'] = (string) $this->_id;
if ($this->_data) {
$json['data'] = $this->_data;
@@ -137,4 +137,11 @@ class Zend_Mobile_Push_Message_GcmTest extends PHPUnit_Framework_TestCase
$msg->setTtl(10);
$this->assertFalse($msg->validate());
+
+ public function testToJsonIntCollapseKeyEncodedAsString()
+ {
+ $msg = new Zend_Mobile_Push_Message_Gcm();
+ $msg->setId(10);
+ $this->assertEquals('{"collapse_key":"10"}', $msg->toJson());
+ }