Fixes for parsing success results
authorRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2009 03:42:31 +0000 (03:42 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 29 Oct 2009 03:42:31 +0000 (03:42 +0000)
inc/libs/yoomedia_functions.php
inc/request-functions.php

index 6bd9c4e52538561111639bb350eccbe8f7992d59..c6d55228b842dc5c4883aead5747f5cf359b086a 100644 (file)
@@ -388,18 +388,18 @@ function YOOMEDIA_CONVERT_MODE ($mode) {
 }
 
 // Extract code from response
 }
 
 // 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?
        // 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]);
                // 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];
                // Begin with extraction
                $codeArray = explode(" ", $response[0]['id']);
                $code = $codeArray[0];
index 5afd40c3dfed634e578d6b7437aeebfff6fcec74..a3ff1de26a65fb576a319bacad583deedebbcabe 100644 (file)
@@ -167,7 +167,7 @@ function postRequestArray () {
 }
 
 // Setter for whole $_POST array
 }
 
 // Setter for whole $_POST array
-function setPostRequestArray (array $postData) {
+function setPostRequestArray ($postData) {
        $GLOBALS['raw_request']['post'] = $postData;
 }
 
        $GLOBALS['raw_request']['post'] = $postData;
 }