wepay/PHP-SDK — pull request #10 by epriestley (2013-05-20 19:23:41+00:00)
Title: Don't issue a warning if an API response has no "error_code"

In certain unusual situations, the API may produce a JSON response that has no
"error_code" key. In this case, the client currently tries to access it and
issues a warning ("PHP Notice: Undefined property ...") depending on
configuration.

Instead, test that "error_code" exists before accessing it.

You can reproduce this issue with this test script:

```php
request(
'checkout/create',
array(
'account_id' => 'any string',
'short_description' => 'any string',
'type' => 'any string',
'amount' => '1.00',
));
} catch (Exception $ex) {
// Ignore.
}
```
The expected behavior is no output; the actual behavior is that a warning is issued. After this patch, the warning does not occur.

This issue seems to be relatively specific to the "...production on stage" error; other responses consistently seem to have error codes. So an alternative solution would be to adjust the API to return an "error_code" in this case.