I think this behavior is a bit odd too: php -r "echo json_encode(array(0=>'test'));" // ["test"] php -r "echo json_encode(array(1=>'test'));" // {"1":"test"}
On Tue, Mar 10, 2009 at 11:32 AM, Richard Quadling <rquadl...@googlemail.com > wrote: > 2009/3/2 Scott MacVicar <sc...@macvicar.net>: > > Richard Quadling wrote: > >> 2009/3/2 Scott MacVicar <sc...@macvicar.net>: > >>> Richard Quadling wrote: > >>>> Hi. > >>>> > >>>> Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch > >>>> to the unit tests too. > >>>> > >>>> Any chance this could get committed to 5.2+ > >>>> > >>> I'm too convinced of the parameter name and I don't think its something > >>> that should be added to 5.2.9 since its a feature. > >>> > >>> Scott > >>> > >> > >> 5.3+ would be OK then. > >> > >> As to the param name, I'm not actually changing the name, just adding > >> another flag. > >> > >> In javascript's terminology,the output is an array ... > >> > >> [] > >> > >> or a hash > >> > >> {} > >> > >> So forcing a hash for arrays is pretty much what would be wanted and I > >> as I comment in the request, we have a "force" option when coming FROM > >> json data ... json_decode ( string $json [, bool $assoc= false [, int > >> $depth= 512 ]] ) > >> > >> And the "name" of the param here is appropriate to PHP's use (assoc is > >> not part of JSON's or JS's terminology). > >> > >> If you can think of a better name for the flag, then I'd be glad to use > it. > >> > > > > The JSON spec refers to them as arrays or objects though, as does our > > documentation I believe. > > > > PHP_JSON_FORCE_OBJECT > > > > I however have another patch for more strict encoding so I'll try to > > roll this in a single update. > > > > Scott > > > > First of all, this isn't a "why is this not done yet" message. Honestly. > > Do you have any timeframe for this though? > > Do you think it will be ready for 5.3RC1? > > Thank you, > > Richard Quadling. > > -- > ----- > Richard Quadling > Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 > "Standing on the shoulders of some very clever giants!" > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > >