ZF2 JSON server size issue

For programming and general questions on Zend Framework

ZF2 JSON server size issue

Postby amit_dangwal on Thu Dec 13, 2012 6:24 pm

Hi All

I am new to Zend and putting up my best effort to learn and build an web applicaton using Zend framework2, Dojo and Zend Json server. I have written a html page using dojo components. My page first download completely(no json call at this point). I have added a onBlur function which makes call to Json server for response and parses the response to load country filterselect box. Dojo filterselect uses json rpc client which makes call to server and returns the data. If my data(record in DB) is upto 60 records then it works perfactly fine. But if that list is beyond 60 records(in may case 200+ records), zend server dumps an exception (as response it holds json data + exception which fails parsing) "Warning: Cannot modify header information - headers already sent by (output started at "

Json server details
public function populatelistAction() {
$class = "MO\Model\MOGuest";
$server = new Server();
$server->setClass($class);
if ('GET' == $_SERVER['REQUEST_METHOD']) {
$server->setTarget('populatelist')->setEnvelope(Smd::ENV_JSONRPC_2);
$smd = $server->getServiceMap();
// Set Dojo compatibility:
$smd->setDojoCompatible(true);
header('Content-Type: application/json');
echo $smd;
return $this->getResponse();
} else {
//$server->handle();
}
$server->handle();
return $this->getResponse();
}


Please guide me on the issue as I am clueless as it works upto 60 rec and fails for more then that. Below is the exception I got. Is this a bug or any thing I missed. I validated it has nothing to do with Dojo as the direct call to service (using Restclient firefox addon) also it fails.

{"id":"208","catcode":"SR"},{"id":"209","catcode":"SJ"},{"id":"210","catcode":"SZ"},{"id":"211","catcode":"SE"},{"id":"212","catcode":"CH"},{"id":"213","catcode":"SY"},{"id":"214","catcode":"TW"},{"id":"215","catcode":"TJ"},{"id":"216","catcode":"TZ"},{"id":"217","catcode":"TH"},{"id":"218","catcode":"TL"},{"id":"219","catcode":"TG"},{"id":"220","catcode":"TK"},{"id":"221","catcode":"TO"},{"id":"222","catcode":"TT"},{"id":"223","catcode":"TN"},{"id":"224","catcode":"TR"},{"id":"225","catcode":"TM"},{"id":"226","catcode":"TC"},{"id":"227","catcode":"TV"},{"id":"228","catcode":"UG"},{"id":"229","catcode":"UA"},{"id":"230","catcode":"AE"},{"id":"231","catcode":"US"},{"id":"232","catcode":"UM"},{"id":"233","catcode":"UY"},{"id":"234","catcode":"UZ"},{"id":"235","catcode":"VU"},{"id":"236","catcode":"VE"},{"id":"237","catcode":"VN"},{"id":"238","catcode":"VG"},{"id":"239","catcode":"VI"},{"id":"240","catcode":"GB"},{"id":"241","catcode":"WF"},{"id":"242","catcode":"EH"},{"id":"243","catcode":"YE"},{"id":"244","catcode":"ZM"},{"id":"245","catcode":"ZW"}]],"id":"1"}<br />
<font size='1'><table class='xdebug-error' dir='ltr' border='1' cellspacing='0' cellpadding='1'>
<tr><th align='left' bgcolor='#f57900' colspan="5"><span style='background-color: #cc0000; color: #fce94f; font-size: x-large;'>( ! )</span> Warning: Cannot modify header information - headers already sent by (output started at C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Json\Server\Server.php:182) in C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Http\PhpEnvironment\Response.php on line <i>62</i></th></tr>
<tr><th align='left' bgcolor='#e9b96e' colspan='5'>Call Stack</th></tr>
<tr><th align='center' bgcolor='#eeeeec'>#</th><th align='left' bgcolor='#eeeeec'>Time</th><th align='left' bgcolor='#eeeeec'>Memory</th><th align='left' bgcolor='#eeeeec'>Function</th><th align='left' bgcolor='#eeeeec'>Location</th></tr>
<tr><td bgcolor='#eeeeec' align='center'>1</td><td bgcolor='#eeeeec' align='center'>0.0236</td><td bgcolor='#eeeeec' align='right'>644056</td><td bgcolor='#eeeeec'>{main}( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\public\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>0</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>2</td><td bgcolor='#eeeeec' align='center'>0.7178</td><td bgcolor='#eeeeec' align='right'>9273664</td><td bgcolor='#eeeeec'>Zend\Mvc\Application->run( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\public\index.php' bgcolor='#eeeeec'>..\index.php<b>:</b>12</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>3</td><td bgcolor='#eeeeec' align='center'>1.8114</td><td bgcolor='#eeeeec' align='right'>11844912</td><td bgcolor='#eeeeec'>Zend\EventManager\EventManager->trigger( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Mvc\Application.php' bgcolor='#eeeeec'>..\Application.php<b>:</b>303</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>4</td><td bgcolor='#eeeeec' align='center'>1.8114</td><td bgcolor='#eeeeec' align='right'>11845120</td><td bgcolor='#eeeeec'>Zend\EventManager\EventManager->triggerListeners( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php' bgcolor='#eeeeec'>..\EventManager.php<b>:</b>208</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>5</td><td bgcolor='#eeeeec' align='center'>1.8138</td><td bgcolor='#eeeeec' align='right'>11847840</td><td bgcolor='#eeeeec'><a href='http://www_php_net/call_user_func' target='_new'>call_user_func</a>
( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php' bgcolor='#eeeeec'>..\EventManager.php<b>:</b>468</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>6</td><td bgcolor='#eeeeec' align='center'>1.8138</td><td bgcolor='#eeeeec' align='right'>11847872</td><td bgcolor='#eeeeec'>Zend\Mvc\View\SendResponseListener->sendResponse( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\EventManager\EventManager.php' bgcolor='#eeeeec'>..\EventManager.php<b>:</b>468</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>7</td><td bgcolor='#eeeeec' align='center'>1.8139</td><td bgcolor='#eeeeec' align='right'>11847872</td><td bgcolor='#eeeeec'>Zend\Http\PhpEnvironment\Response->send( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Mvc\View\SendResponseListener.php' bgcolor='#eeeeec'>..\SendResponseListener.php<b>:</b>71</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>8</td><td bgcolor='#eeeeec' align='center'>1.8139</td><td bgcolor='#eeeeec' align='right'>11847872</td><td bgcolor='#eeeeec'>Zend\Http\PhpEnvironment\Response->sendHeaders( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Http\PhpEnvironment\Response.php' bgcolor='#eeeeec'>..\Response.php<b>:</b>100</td></tr>
<tr><td bgcolor='#eeeeec' align='center'>9</td><td bgcolor='#eeeeec' align='center'>1.8142</td><td bgcolor='#eeeeec' align='right'>11848000</td><td bgcolor='#eeeeec'><a href='http://www/php/net/header' target='_new'>header</a>
( )</td><td title='C:\Users\amsh\Documents\NetBeansProjects\myoffice\vendor\zendframework\zendframework\library\Zend\Http\PhpEnvironment\Response.php' bgcolor='#eeeeec'>..\Response.php<b>:</b>62</td></tr>
</table></font>"
amit_dangwal
 
Posts: 6
Joined: Thu Dec 13, 2012 6:05 pm

Re: ZF2 JSON server size issue

Postby amit_dangwal on Tue Dec 18, 2012 9:04 am

I strongly believe it is a defect and a fix has been created by me for this. Only Zend team will confirm about the issue and fix. Sadly as of now no one has looked into the issue.

More details are on below link: If you plan to use this fix then you have to make sure the fix is correct as I am not the right person to guarantee about the fix. For that conatct Zend framework team.
https_//github_com/zendframework/zf2/issues/3225

need to replace _ with : and .as zend forums does nto allow url
amit_dangwal
 
Posts: 6
Joined: Thu Dec 13, 2012 6:05 pm


Return to Zend Framework

Who is online

Users browsing this forum: No registered users and 3 guests