Edit report at https://bugs.php.net/bug.php?id=63007&edit=1
ID: 63007 Comment by: janfili+phpbugs at gmail dot com Reported by: janfili+phpbugs at gmail dot com Summary: json functions corrupt arrayindizes Status: Not a bug Type: Bug Package: JSON related Operating System: Linux ubuntu1010 PHP Version: 5.3.16 Block user comment: N Private report: N New Comment: not similar to https://bugs.php.net/bug.php?id=51915 51915 mentions that the indexes become strings, and that is the case of course through json en/decoding. The bug described in this ticket is that the elements belonging to these keys are not retrievable anymore. even if you explicitly get the keys $k = array_keys($array); echo $array[$k[0]]; will result in undefined index. Reductio ad absurdum Previous Comments: ------------------------------------------------------------------------ [2012-09-04 11:17:17] larue...@php.net similar to https://bugs.php.net/bug.php?id=51915 ------------------------------------------------------------------------ [2012-09-04 08:21:08] reeze dot xia at gmail dot com Yes, it will not accessible anymore if you have property with string number. since array handle keys different from objects. ------------------------------------------------------------------------ [2012-09-04 08:19:17] reeze dot xia at gmail dot com Ah, I'm sorry, the bug ID: #54082, I can't find the report right now. will post that later ------------------------------------------------------------------------ [2012-09-04 08:18:29] janfili+phpbugs at gmail dot com using this var_dump($array['1']); as the last statement will not help either ------------------------------------------------------------------------ [2012-09-04 08:04:22] reeze dot xia at gmail dot com This is not a problem of JSON itself. but. array vs object conversion. and it was documented: http://www.php.net/manual/en/language.types.array.php#language.types.array.casti ng after json_encode key: 1 was encoded as string. In object properties and only been string key. but after convert to array, it will not be able to accessed since. if the key will be changed to number key if possible. similar to https://bugs.php.net/bug.php?id=54082 ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=63007 -- Edit this bug report at https://bugs.php.net/bug.php?id=63007&edit=1