Closed
Description
To day we encountered a strange error while trying to send a Pushwoosh message.
Here it is :
Argument 1 passed to Gomoob\Pushwoosh\Model\Response\CreateMessageResponse::create() must be of the type array, null given, called in /home/ec2-user/project-xxxx/zf2/vendor/gomoob/php-pushwoosh/src/main/php/Gomoob/Pushwoosh/Client/Pushwoosh.php on line 142 and defined
It appears the CURLClient.pushwooshCall($method, array $data)
returned a null
response which is not normal.
The implementation of the CURLClient
is not robust enough because it simply log errors in the console which is very very bad.
...
$response = curl_exec($ch);
$error = curl_error($ch);
if ($error) {
$info = curl_getinfo($ch);
// FIXME
var_dump($error);
var_dump($info);
}
curl_close($ch);
return json_decode($response, true);
Here we should do 2 things :
- If a curl error is encountered wrap it inside a
PushwooshException
(perhaps this class has to be improved to be able to attach more details to an exception) - If no curl error is encountered and the
$response
variable isnull
create aPushwooshException
too
In all cases throw the exception if an error is encountered.