1.9.3.0 업데이트 후 SOAP 연결 문제


12

Magento Store를 1.9.2.4에서 1.9.3.0으로 업데이트했습니다.

SOAP / XML-RPC 사용자를 통해 연결되는 배송 소프트웨어 (Shipworks)를 사용합니다.

업데이트 shipworks 로깅 후이 응답이 로그에 표시됩니다.

<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
-<SOAP-ENV:Body>
-<SOAP-ENV:Fault>
<faultcode>1</faultcode>
<faultstring>Internal Error. Please see log for details.</faultstring>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

그래서 Magento에서 예외 로깅을 켜고 다음 오류가 발생했습니다.

2016-10-13T18:24:14+00:00 ERR (3): 
SoapFault exception: [1] Internal Error. Please see log for details. in /public_html/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php:196
Stack trace:
#0 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(140): Mage_Api_Model_Server_Adapter_Soap->fault('1', 'Internal Error....')
#1 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(48): Mage_Api_Model_Server_Handler_Abstract->_fault('internal')
#2 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(559): Mage_Api_Model_Server_Handler_Abstract->handlePhpError(4096, 'Argument 1 pass...', '/home/deepsix/p...', 559, Array)
#3 /public_html/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php(299): Mage_Api_Model_Server_Handler_Abstract->processingMethodResult('<?xml version="...')
#4 [internal function]: Mage_Api_Model_Server_Handler_Abstract->call('ca4d34d100c92c8...', 'shipWorksApi.ge...', Array)
#5 /public_html/lib/Zend/Soap/Server.php(889): SoapServer->handle('<?xml version="...')
#6 /public_html/app/code/core/Mage/Api/Model/Server/Adapter/Soap.php(174): Zend_Soap_Server->handle()
#7 /public_html/app/code/core/Mage/Api/Model/Server.php(138): Mage_Api_Model_Server_Adapter_Soap->run()
#8 /public_html/app/code/core/Mage/Api/controllers/SoapController.php(40): Mage_Api_Model_Server->run()
#9 /public_html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Api_SoapController->indexAction()
#10 /public_html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(254): Mage_Core_Controller_Varien_Action->dispatch('index')
#11 /public_html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#12 /public_html/app/code/core/Mage/Core/Model/App.php(365): Mage_Core_Controller_Varien_Front->dispatch()
#13 /public_html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#14 /public_html/index.php(83): Mage::run('', 'store')
#15 {main}

그래서 나는 1.9.2.4와 1.9.3.0에서 Abstract.php 사이에 차이점을 가지고 다음을 얻었습니다.

290a291
>                 $result = array();
292c293
<                     return $model->$method((is_array($args) ? $args : array($args)));
---
>                     $result = $model->$method((is_array($args) ? $args : array($args)));
294c295
<                     return $model->$method($args);
---
>                     $result = $model->$method($args);
296c297
<                     return call_user_func_array(array(&$model, $method), $args);
---
>                     $result = call_user_func_array(array(&$model, $method), $args);
297a299
>                 return $this->processingMethodResult($result);
403a406
>                     $callResult = array();
405c408
<                         $result[] = $model->$method((is_array($args) ? $args : array($args)));
---
>                         $callResult = $model->$method((is_array($args) ? $args : array($args)));
407c410
<                         $result[] = $model->$method($args);
---
>                         $callResult = $model->$method($args);
409c412
<                         $result[] = call_user_func_array(array(&$model, $method), $args);
---
>                         $callResult = call_user_func_array(array(&$model, $method), $args);
410a414
>                     $result[] = $this->processingMethodResult($callResult);
544a549,585
>     }
> 
>     /**
>      * Prepare Api data for XML exporting
>      * See allowed characters in XML:
>      * @link http://www.w3.org/TR/2000/REC-xml-20001006#NT-Char
>      *
>      * @param array $result
>      * @return mixed
>      */
>     public function processingMethodResult(array $result)
>     {
>         foreach ($result as &$row) {
>             if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
>                 $row = $this->processingRow($row);
>             }
>         }
>         return $result;
>     }
> 
>     /**
>      * Prepare Api row data for XML exporting
>      * Convert not allowed symbol to numeric character reference
>      *
>      * @param $row
>      * @return mixed
>      */
>     public function processingRow($row)
>     {
>         $row = preg_replace_callback(
>             '/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}\x{10000}-\x{10FFFF}]/u',
>             function ($matches) {
>                 return '&#' . Mage::helper('core/string')->uniOrd($matches[0]) . ';';
>             },
>             $row
>         );
>         return $row;

도움을 주시면 감사하겠습니다.

답변:


14

다른 확장명과 동일한 오류가 있습니다. system.log는 말합니다

Mage_Api_Model_Server_Handler_Abstract :: processingMethodResult ()에 전달 된 인수 1은 app / code / core / Mage / Api / Model / Server / Handler / Abstract.php에서 호출 된 유형의 배열, 문자열이어야합니다 ...

문제는 새로운 방법이라고 생각합니다

Mage_Api_Model_Server_Handler_Abstract::processingMethodResult(array $result)

배열 만 허용합니다. 따라서 스칼라 값을 반환하는 모든 Api 함수는이 오류를 발생시킵니다. 이 다시 내가 복사 가야 app/code/core/Mage/Api/Model/Server/Handler/Abstract.php로 app/code/local/Mage/Api/Model/Server/Handler/Abstract.php및 패치 processingMethodResult:

public function processingMethodResult($result)
{
    if (is_array($result)) {
        foreach ($result as &$row) {
            if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
                if (is_array($row)) {
                    $row = $this->processingMethodResult($row);
                } else {
                    $row = $this->processingRow($row);
                }
            }
        }
    } else {
        if (!is_null($result) && !is_bool($result) && !is_numeric($result)) {
            $result = $this->processingRow($result);
        }
    }
    return $result;
}

어떤 버전의 magento를 실행하고 있습니까?
— LandonL

문제가 해결됩니다. 왜 magento 코어 파일이 어쨌든 array vs string으로 변경됩니까?
— LandonL

훌륭한 수정, 감사합니다. 누구든지 이것을 Magento의 버그로 제기 했습니까? 많은 사람들이 이것에 물릴 것입니다.
— BlueC

변경 사항은 PHP7과 관련이 있습니다. 아래 답변을 참조하십시오. 또한 stackoverflow.com/a/4103536/158325 버그는 아니지만 API PHP7과 호환됩니다.
— B00MER

1
@ LanddonL : 1.9.2.4에서 1.9.3.0으로 업데이트되었습니다.
— Belgor

1

ShipStation 모듈 및 / 또는 실행중인 PHP 버전이 호환되지 않을 수 있습니다.

리턴 된 잘린 PHP 오류 메시지를 추측합니다.

Argument 1 pass...' 가장 가능성이 높습니다 Argument 1 passed to methodhere() must be an instance of string, string given

실행중인 PHP 버전과 ShipStation에 문의하여 최신 Magento 버전 / 패치와 최신 버전 및 / 또는 호환성 문제가 있는지 확인하십시오.

또한 여기에 약간의 로깅을 추가 할 수 있습니다 : https://github.com/OpenMage/magento-mirror/blob/magento-1.9/lib/Zend/Soap/Server.php#L889 잘린 PHP 오류를 더 많이 캡처 올바른 오류가 반환되는지 확인하기 위해 반환됩니다.

도움이 되었기를 바랍니다.


잘린 오류를 더 많이 얻으려면 어떻게해야합니까? 줄 길이를 늘리는 방법을 잘 모르겠습니다.
— LandonL

시스템은 현재 PHP 5.6.25를 실행 중이며 오늘 shipworks를 호출했지만 magento 업데이트 1.9.3.0이 어제 나왔으므로 아직 문제를 볼 기회가 없다고 생각합니다.
— LandonL

1

Belgors의 답변이 실제로 도움이되었지만 API 리포지토리에 추가 객체가 포함될 수 있도록 패치를 약간 수정했습니다.

예를 들어 , 주문 정보에 대한 Magento XML-RPC 호출을 사용하여 aheadWorks storecredit 및 / 또는 기프트 카드 객체 배열을 얻을 수 있습니다.

(Björn Tantau의 제안에서 객체 및 컬렉션 작업을 개선하기 위해 코드가 업데이트되었습니다)

public function processingMethodResult($result)
{
    if (is_object($result) && is_callable(array($result, 'toArray'))) {
        $result = $result->toArray();
    }
    if (is_array($result)) {
        foreach ($result as &$row) {
            if (is_object($row) && is_callable(array($row, 'toArray'))) {
                $row = $row->toArray();
            }
            if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
                if (is_array($row)) {
                    $row = $this->processingMethodResult($row);
                } else {
                    $row = $this->processingRow($row);
                }
            }
        }
    } else {
        if (!is_null($result) && !is_bool($result) && !is_numeric($result)) {
            $result = $this->processingRow($result);
        }
    }
    return $result;
}
당사 사이트를 사용함과 동시에 당사의 쿠키 정책과 개인정보 보호정책을 읽고 이해하였음을 인정하는 것으로 간주합니다.
Licensed under cc by-sa 3.0 with attribution required.