-- Christoph Dorn <[EMAIL PROTECTED]> wrote
(on Thursday, 04 September 2008, 10:54 AM -0700):
> It is an issue with Zend_Json_Encoder.
>
> The problem is that JSON does not support associative arrays. See ticket
> http://framework.zend.com/issues/browse/ZF-4159
Actually, that's not entirely true. PHP associative arrays translate
basically to JS objects. The problem occurs when PHP needs to encode an
array -- is an array with numeric indices an associative or normal
indexed array? The typical test used is something like this:
if (array_keys($array) == range(0, count($array) - 1)) {
// indexed
} else {
// associative
}
In the example the poster provided, it would be evaluated as an indexed
array.
> I am working on a solution but do not have a timeline yet.
>
> Thanks for reporting your use-case. I have added a comment to the ticket.
>
> Christoph
>
>
>
> Jan Pieper wrote:
> > Hi guys,
> >
> > today I tried to use the new Zend_Log_Writer_Firebug and it works
> > fine, but there is something irritating. If you log something like this:
> >
> > # $logger->log(array('data' => array(0 => 1)), Zend_Log::DEBUG);
> >
> > Firebug will show:
> >
> > # array(['data'] => 1)
> >
> > It is because the given array will be encoded to {'data':[1]} and []
> > is no associated array but I think the result is something
> > "completely" different.
> >
> > # array('data' => array(0 => 1)) != array('data' => 1)
> >
> > Is there a chance to get it fixed or is it a Firebug issue?
> >
> > Regards,
> > Jan Pieper
> >
>
>
> --
> Christoph Dorn
> <http://www.ChristophDorn.com/> http://www.ChristophDorn.com/
>
--
Matthew Weier O'Phinney
Software Architect | [EMAIL PROTECTED]
Zend Framework | http://framework.zend.com/