$return = $GLOBALS['translation_tables']['yoomedia']['error_codes'][$errorCode];
} else {
// Log missing entries
- logDebugMessage(__FUNCTION__, __LINE__, "errorCode={$errorCode}");
- print('<pre>');
- debug_print_backtrace();
- die('</pre>');
+ debug_report_bug(sprintf("Unknown error code <strong>%s</strong> detected.", $erroCode));
}
// Return value
}
// Extract code from response
-function YOOMEDIA_GET_ERRORCODE_FROM_RESULT (array $response) {
+function YOOMEDIA_GET_ERRORCODE_FROM_RESULT ($response) {
// Bad code as default
$code = -999;
// Which response should we parse?
- if (isset($response[8])) {
+ if ((isset($response[8])) && (count($response) == 9)) {
// Use error code from element 8 (mostly API errors)
$codeArray = explode("<br>", $response[8]);
// Use only the first element
$code = bigintval($codeArray[0]);
- } elseif (isset($response[0]['id'])) {
+ } elseif ((is_array($response[0])) && (isset($response[0]['id']))) {
// Begin with extraction
$codeArray = explode(" ", $response[0]['id']);
$code = $codeArray[0];