[Tickets #5604] Re: ListMessages endless loop

bugs at bugs.horde.org bugs at bugs.horde.org
Mon Aug 6 02:26:22 UTC 2007


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=5604
-----------------------------------------------------------------------
 Ticket             | 5604
 Updated By         | Chuck Hagenbuch <chuck at horde.org>
 Summary            | ListMessages endless loop
 Queue              | DIMP
 Version            | 1.0-ALPHA
 Type               | Bug
 State              | Feedback
 Priority           | 3. High
 Owners             | 
-----------------------------------------------------------------------


Chuck Hagenbuch <chuck at horde.org> (2007-08-05 19:26) wrote:

> Yes, PHP on CentOS5 doesn't have json extension. If I use var_export 
> on original code, I get this output:
>
>     'msglist' =>
>   stdClass::__set_state(array(
>   )),
>
> but when I remove typecast to "object", I get different output:
>
>     'msglist' =>
>   array (
>     1 => 1,
>     2 => 2,
>     3 => 3,
>   ),

That's weird; that actually indicates to me a PHP bug, that you're losing
the values of the array when casting it to an object.

We need to cast it to an object, otherwise the JSON would probably look
like this:

[1, 2, 3]

instead of:

{'1': 1, '2': 2, '3': 3}

(which is important when it's 10048, 10051, 10046, in that order, and not
just 1, 2, 3).

Can you make a short test script which is just:

<?php

var_dump((object)array('1' => 1, '2' => 2));
echo var_export((object)array('1' => 1, '2' => 2), true);


And run it on both versions? (interestingly, the var_export might just
mangle it. The var_dump is okay in my case though. Looks like it might be a
bug in our json encoder, except that it's weird that the effect of
var_export is exactly what you see when using var_export on it ...)



More information about the bugs mailing list