升级后出现错误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;
}
我住在这里。第一个旧的lib(2.0.4)运行良好,我升级它是因为要求使用zfcuser,zfcbase。但是新的lib(2.0.6)在第二次调用(以及除logon
方法之外的任何方法)中都出现了这个错误。
答案 0 :(得分:0)
前段时间我使用XML-RPC访问OpenX API时遇到了问题,但事实证明解决方案很简单: http://www.openxrest.com/xml-rpc2-returns-empty-decoded-result/
此外,您应该打开调试模式。请参阅此链接以了解如何启用它: http://devzone.zend.com/97/xml_rpc-client/#Heading9