0

升级 zf 2.0.4 => 2.0.6 后出现错误

Zend\Http\Exception\RuntimeException

File:

D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\Http\Response.php:449

Message:

Error parsing body - doesn't seem to be a chunked message

Stack trace:

#0 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\Http\Response.php(303): Zend\Http\Response->decodeChunkedBody('???????????????...')
#1 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\XmlRpc\Client.php(245): Zend\Http\Response->getBody()
#2 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\XmlRpc\Client.php(318): Zend\XmlRpc\Client->doRequest(Object(Zend\XmlRpc\Request))
#3 D:\xampp\htdocs\htm\base\module\Zone\src\Zone\Controller\AdminController.php(132): Zend\XmlRpc\Client->call('ox.agencyZoneSt...', Array)
#4 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractActionController.php(90): Zone\Controller\AdminController->manageAction()
#5 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#6 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(464): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#7 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(208): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#8 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\Mvc\Controller\AbstractController.php(107): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#9 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\Mvc\DispatchListener.php(113): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Http\PhpEnvironment\Request), Object(Zend\Http\PhpEnvironment\Response))
#10 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#11 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(464): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#12 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php(208): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 D:\xampp\htdocs\htm\base\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php(297): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#14 D:\xampp\htdocs\htm\base\public\index.php(15): Zend\Mvc\Application->run()
#15 {main}

我发现它来自我的Zend\XMLRpc\Client电话

$httpClient = new \Zend\Http\Client();
$oxClient = new \Zend\XmlRpc\Client('http://xxx.com/www/api/v2/xmlrpc/',$httpClient);
$oxSession = $this->oxClient->call('ox.logon',$oxLogin); 
$zone_list = $this->oxClient->call('ox.agencyZoneStatistics',array($oxSession,$agency_id)); 

我调用 OpenX API 系统。在第一次通话logon时成功,但第二次失败??!我认为我的问题点decodeChunkedBody在于Zend\Http\Response.php. 它无法理解来自 OpenX 的分块响应

protected function decodeChunkedBody($body)
{
    $decBody = '';

    while (trim($body)) {
        if (! preg_match("/^([\da-fA-F]+)[^\r\n]*\r\n/sm", $body, $m)) {
            throw new Exception\RuntimeException(
                "Error parsing body - doesn't seem to be a chunked message"
            );
        }

        $length   = hexdec(trim($m[1]));
        $cut      = strlen($m[0]);
        $decBody .= substr($body, $cut, $length);
        $body     = substr($body, $cut + $length + 2);
    }

    return $decBody;
}

我卡在这里。第一个旧库(2.0.4)运行良好,我升级它是因为需要使用 zfcuser、zfcbase。但是新的库(2.0.6)在第二次调用(以及任何logon方法除外)中出现了这个错误。

4

1 回答 1

0

不久前,我在使用 XML-RPC 访问 OpenX API 时遇到了问题,但事实证明解决方案很简单: http ://www.openxrest.com/xml-rpc2-returns-empty-decoded-result/

此外,您应该打开调试模式。请参阅此链接以了解如何打开它: http ://devzone.zend.com/97/xml_rpc-client/#Heading9

于 2012-12-20T12:13:50.823 回答