Question

I got error after upgrade 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}

And i detect it's come from my Zend\XMLRpc\Client call

$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)); 

I call to OpenX API system. At the first call with logon was success but the second fail ??! I think my problem point in decodeChunkedBody function at Zend\Http\Response.php. It's cannt understand chunked response from 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;
}

I stuck here. The first old lib (2.0.4) work well , i upgrade it because the requirement for using zfcuser,zfcbase. But the new lib (2.0.6) got this error in second call ( and any except logon method ).

No correct solution

OTHER TIPS

A while back I had a problem using XML-RPC to access OpenX API but it turns out the solution was simple: http://www.openxrest.com/xml-rpc2-returns-empty-decoded-result/

Also, you should turn debug mode on. See this link to know how to turn it on: http://devzone.zend.com/97/xml_rpc-client/#Heading9

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top