Bug #73362 [NEW]: json_decode returns dupliate keys when $assoc is set to true
| From: | vvsraju0404 at gmail dot com | Date: | Fri, 21 Oct 2016 03:23:21 +0000 |
| Subject: | Bug #73362 [NEW]: json_decode returns dupliate keys when $assoc is set to true | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-204943@lists.php.net to get a copy of this message | ||
From: vvsraju0404 at gmail dot com
Operating system: GNU/Linux CentOS release 6.7
PHP version: 5.6.27
Package: JSON related
Bug Type: Bug
Bug description:json_decode returns dupliate keys when $assoc is set to true
Description:
------------
I am fetching a JSON from webservice which is returning data with
duplicate keys .
curl_setopt($ch, CURLOPT_URL, $url);
$result = curl_exec($ch);
$json_result = json_decode($result,true);
When i decode the JSON with json_decode with $assoc flag as true ; i was
expecting that as the result is associative array , there wouldn't be
any duplicates but $json_result has duplicate keys .
Expected result:
----------------
When i decode the JSON with json_decode with $assoc flag as true, there
shouldn't be any duplicate keys as returned data structure is
associative array .
--
Edit bug report at https://bugs.php.net/bug.php?id=73362&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73362&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73362&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73362&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73362&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73362&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73362&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73362&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73362&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73362&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73362&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73362&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73362&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73362&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73362&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73362&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73362&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73362&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73362&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73362&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73362&r=mysqlcfg