My Problem is that the php  json_decode() does not work when remotely
calling a cake controller method which just returns a json string.
The problem seems to be in the last lines of the webroot/index.php,
which append the execution time to every output:

if (Configure::read() > 0) {
                 echo "<!-- " . round(getMicrotime() - $TIME_START, 4) . "s 
-->";
        }

with the microtime/comment attached the php json parser does not
return anything. When trying to parse this string with javascript
there is no problem(that´s why i never noticed).

does anyone had a similar problem?

My controller returning the string looks like this:

function whatever() {

  $this->layout = 'ajax';
  $data = $this->toJson($myArray);
  $this->set('data',$data);
  $this->render('json');
}

the view:
<?php echo $data; ?>

I´m wondering if i could use some other settings in the controller
method instead of commenting out the "time attach" index.php.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake 
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to