Skip to content

Commit 66389af

Browse files
committed
Handle non-integer error codes coming back from the API
This deals with errors we're getting on our live service from highly intermittent issues with getSearchResults - looks like the error code is non-numeric, and hence raises a "Wrong parameters for Exception([string $exception [, long $code ]])" error at line 848 in the PHP API.
1 parent bb55a9a commit 66389af

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

php/fotolia-api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -839,7 +839,7 @@ protected function _api($method, $args = array(), $auto_refresh_token = TRUE)
839839
$error_msg = $res['error'];
840840

841841
if (!empty($res['code'])) {
842-
$error_code = $res['code'];
842+
$error_code = (int) $res['code'];
843843
}
844844
} else {
845845
$error_msg = 'Invalid response HTTP code: ' . $http_code;

0 commit comments

Comments
 (0)