On Fri, Aug 15, 2008 at 12:31 PM, Terre Porter
<[EMAIL PROTECTED]> wrote:
>
> I've been following this a little.
>
> If I understand this right...
>
> The json decode works if you dump the var but not if you allow the page to
> run through the view.
>
> What happens in the view?
>
> You mention these :
>
> -- sets HTML head
> -- spits out contents

My Layout:

<?php

        // <meta>
        $this->headMeta()
                ->appendHttpEquiv('Content-Type', 'text/html; charset=UTF-8')
                ->appendHttpEquiv('Content-Language', 'en-US');
                
        $this->headTitle()
                ->headTitle('My Page', 'APPEND');
                
        echo $this->doctype('XHTML1_STRICT');
?>

<html xmlns="http://www.w3.org/1999/xhtml";>
        <head>
                <?= $this->headMeta() ?>
                
                <?= $this->headTitle() ?>
        
        </head>
        <body>
                <?= $this->layout()->content ?>
                
        </body>
</html>

My View:
<h1>HELLO WORLD</h1>

In the course of debugging this, I've tried to take out all of the
possible bugs, I've narrowed it down to one thing: attempting to
json_decode a perfectly valid JSON string, which I've attached, prior
to preDispatch(), View, Layout rendering causes blank screen.

- jake

>
> Does the view do anything to the data? i.e. expect a exact array key to
> exist?
>
> Just some thoughts
> Terre
>
>
> -----Original Message-----
> From: Jake McGraw [mailto:[EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 12:13 PM
> To: fw-general@lists.zend.com
> Subject: Re: [fw-general] Zend_Json::decode in Controller causing Blank
> Screen of Death
>
>> Comment out the above line and see what happens -- this is what the
>> previous comment was getting at.
>>
>
> Still not working, commented out line, restarted apache, same issue...
> I'm not sure that this is related to json/xdebug, as
> Zend_Json::decode/json_decode both operate correctly with the same JSON
> string outside of the Zend MVC, it is only when I use any of the
> following:
>
> Zend_Json::decode($jsonString);
>
> Zend_Json::$useBuiltinEncoderDecoder = TRUE Zend_Json::decode($jsonString);
>
> json_decode($jsonString, TRUE);
>
> and then allow Layout, View to render that I get the blank screen.
> Note, I'm not actually doing anything with the resulting PHP array from the
> decoding. I'm not passing it to the view, which simply sets the HTML head
> and spits out the content. I'm just attempting to dump it.
>
> Again, thanks for the help!
>
> - jake
>
>>
>>> Again, nothing in error reporting, logging, etc. Just a blank screen.
>>> Also, this works fine (same JSON) outside of Zend_Controller_Action.
>>>
>>> > -Matt
>>> >
>>> > On Fri, Aug 15, 2008 at 8:20 AM, Jake McGraw <[EMAIL PROTECTED]>
> wrote:
>>> >>
>>> >> I've spent the last two days struggling with this error:
>>> >>
>>> >> We've been utilizing REST-ful JSON server for a couple of months now
> to host our data api (it's written using Zend Framework). Our client apps
> access this API, and decode the JSON. Yesterday, one of our client apps
> stopped working, generating no errors, no ouput, just a blank screen. After
> commenting out the majority of the code, we found the following code was
> causing the grief:
>>> >>
>>> >> <?php
>>> >>
>>> >> // BaseController extends Zend_Controller_Action class
>>> >> CustomController extends BaseController {
>>> >>
>>> >>   public function someAction() {
>>> >>
>>> >>     $result = $this->api->get('resource', array('field1' =>
>>> >> 'value1'));
>>> >>
>>> >>     $result =
>>> >> Zend_Json::decode($result->getResponse()->getBody());
>>> >>
>>> >>     var_dump($result);
>>> >>
>>> >>     // exit;
>>> >>   }
>>> >>
>>> >> }
>>> >>
>>> >> Now, we only get the blank screen when we allow our dispatcher to
> render our Zend_Layout, Zend_View AFTER using Zend_Json::decode, all the
> following logic steps work fine:
>>> >>
>>> >> - Uncomment exit, prevent Layout, View rendering
>>> >> var_dump($result); exit;
>>> >>
>>> >> - Check body for valid JSON (everything OK in JSON Lint)
>>> >> - Layout, View render correctly
>>> >> var_dump($result->getResponse()->getBody());
>>> >>
>>> >> - Try another JSON string
>>> >> - Layout, View render correctly
>>> >> var_dump(Zend_Json::decode('[{"foo":"bar"}]'));
>>> >>
>>> >> The JSON looks something like this:
>>> >>
>>> >> [
>>> >>     {
>>> >>         "cm_broadcast_type": "National Broadcast Networks",
>>> >>         "id": "12659575",
>>> >>         "station_id": "12336",
>>> >>         "program_id": "EP010501290006",
>>> >>         "start_time": "20080814000000",
>>> >>         "end_time": "20080814010000",
>>> >>         "cc": "Y",
>>> >>         "title": "Greatest American Dog"
>>> >>     },
>>> >>     {
>>> >>         "cm_broadcast_type": "National Broadcast Networks",
>>> >>         "id": "11469048",
>>> >>         "station_id": "12336",
>>> >>         "program_id": "EP007537910036",
>>> >>         "start_time": "20080814010000",
>>> >>         "end_time": "20080814020000",
>>> >>         "cc": "Y",
>>> >>         "title": "Criminal Minds"
>>> >>     },
>>> >>     ... Continue ...
>>> >> ]
>>> >>
>>> >> So, as I've said, the problem only occurs when we allow the dispatcher
> to continue rendering Layout, View after using Zend_Json::decode, any help
> would be MUCH appreciated.
>>> >>
>>> >> - jake
>>>
>>
>> --
>> Matthew Weier O'Phinney
>> Software Architect       | [EMAIL PROTECTED]
>> Zend Framework           | http://framework.zend.com/
>>
>
>
[{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455755","station_id":"11705","program_id":"EP010398950044","start_time":"20080814000000","end_time":"20080814050000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455756","station_id":"11705","program_id":"SH010459690000","start_time":"20080814050000","end_time":"20080814053500","cc":"Y","title":"4
 NY News at 11"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455757","station_id":"11705","program_id":"EP010398950045","start_time":"20080814053500","end_time":"20080814063000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455758","station_id":"11705","program_id":"EP010398950044","start_time":"20080814063000","end_time":"20080814090000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455759","station_id":"11705","program_id":"SH000283740000","start_time":"20080814090000","end_time":"20080814110000","cc":"Y","title":"Today
 in New York"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455760","station_id":"11705","program_id":"EP000191506044","start_time":"20080814110000","end_time":"20080814140000","cc":"Y","title":"Today"},{"cm_broadcast_type":"National
 Broadcast 
Networks","id":"11455761","station_id":"11705","program_id":"EP010398950046","start_time":"20080814140000","end_time":"20080814170000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"12647756","station_id":"11705","program_id":"EP007674940422","start_time":"20080814170000","end_time":"20080814180000","cc":"Y","title":"The
 Martha Stewart Show"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"13413525","station_id":"11705","program_id":"EP000011892231","start_time":"20080814180000","end_time":"20080814190000","cc":"Y","title":"Days
 of our Lives"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455764","station_id":"11705","program_id":"EP002775792758","start_time":"20080814190000","end_time":"20080814193000","cc":"Y","title":"Judge
 Joe Brown"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455765","station_id":"11705","program_id":"EP002775792929","start_time":"20080814193000","end_time":"20080814200000","cc":"Y","title":"Judge
 Joe Brown"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455766","station_id":"11705","program_id":"EP005992700823","start_time":"20080814200000","end_time":"20080814210000","cc":"Y","title":"The
 Ellen DeGeneres Show"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455767","station_id":"11705","program_id":"SH010459670000","start_time":"20080814210000","end_time":"20080814213000","cc":"Y","title":"4
 NY News at 5"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455768","station_id":"11705","program_id":"EP001152644448","start_time":"20080814213000","end_time":"20080814220000","cc":"Y","title":"EXTRA"},{"cm_broadcast_type":"National
 Broadcast 
Networks","id":"11455769","station_id":"11705","program_id":"SH010459680000","start_time":"20080814220000","end_time":"20080814223000","cc":"Y","title":"4
 NY News at 6"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455770","station_id":"11705","program_id":"SH000030610000","start_time":"20080814223000","end_time":"20080814230000","cc":"Y","title":"NBC
 Nightly News"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455771","station_id":"11705","program_id":"EP001887073137","start_time":"20080814230000","end_time":"20080814233000","cc":"Y","title":"Access
 Hollywood"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11455772","station_id":"11705","program_id":"SH010751580000","start_time":"20080814233000","end_time":"20080815000000","cc":"N","title":"The
 Olympic Zone"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722965","station_id":"11705","program_id":"EP010398950047","start_time":"20080815000000","end_time":"20080815050000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722966","station_id":"11705","program_id":"SH010459690000","start_time":"20080815050000","end_time":"20080815053500","cc":"Y","title":"4
 NY News at 11"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722967","station_id":"11705","program_id":"EP010398950048","start_time":"20080815053500","end_time":"20080815063000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722968","station_id":"11705","program_id":"EP010398950047","start_time":"20080815063000","end_time":"20080815090000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722969","station_id":"11705","program_id":"SH000283740000","start_time":"20080815090000","end_time":"20080815110000","cc":"Y","title":"Today
 in New York"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722970","station_id":"11705","program_id":"EP000191506049","start_time":"20080815110000","end_time":"20080815140000","cc":"Y","title":"Today"},{"cm_broadcast_type":"National
 Broadcast 
Networks","id":"11722971","station_id":"11705","program_id":"EP010398950049","start_time":"20080815140000","end_time":"20080815170000","cc":"Y","title":"XXIX
 Summer Olympics"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"12647757","station_id":"11705","program_id":"EP007674940496","start_time":"20080815170000","end_time":"20080815180000","cc":"Y","title":"The
 Martha Stewart Show"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"13413526","station_id":"11705","program_id":"EP000011892232","start_time":"20080815180000","end_time":"20080815190000","cc":"Y","title":"Days
 of our Lives"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722974","station_id":"11705","program_id":"EP002775792942","start_time":"20080815190000","end_time":"20080815193000","cc":"Y","title":"Judge
 Joe Brown"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722975","station_id":"11705","program_id":"EP002775792981","start_time":"20080815193000","end_time":"20080815200000","cc":"Y","title":"Judge
 Joe Brown"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722976","station_id":"11705","program_id":"EP005992700824","start_time":"20080815200000","end_time":"20080815210000","cc":"Y","title":"The
 Ellen DeGeneres Show"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722977","station_id":"11705","program_id":"SH010459670000","start_time":"20080815210000","end_time":"20080815213000","cc":"Y","title":"4
 NY News at 5"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722978","station_id":"11705","program_id":"EP001152644449","start_time":"20080815213000","end_time":"20080815220000","cc":"Y","title":"EXTRA"},{"cm_broadcast_type":"National
 Broadcast 
Networks","id":"11722979","station_id":"11705","program_id":"SH010459680000","start_time":"20080815220000","end_time":"20080815223000","cc":"Y","title":"4
 NY News at 6"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722980","station_id":"11705","program_id":"SH000030610000","start_time":"20080815223000","end_time":"20080815230000","cc":"Y","title":"NBC
 Nightly News"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722981","station_id":"11705","program_id":"EP001887073138","start_time":"20080815230000","end_time":"20080815233000","cc":"Y","title":"Access
 Hollywood"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"11722982","station_id":"11705","program_id":"SH010751580000","start_time":"20080815233000","end_time":"20080816000000","cc":"N","title":"The
 Olympic Zone"},{"cm_broadcast_type":"National Broadcast 
Networks","id":"12009028","station_id":"11705","program_id":"EP010398950050","start_time":"20080816000000","end_time":"20080816040000","cc":"Y","title":"XXIX
 Summer Olympics"}]

Reply via email to