#44567 [Opn->Bgs]: json_encode return unexpected result on uncontinues array

From: Date: Sun, 30 Mar 2008 14:23:38 +0000
Subject: #44567 [Opn->Bgs]: json_encode return unexpected result on uncontinues array
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-123783@lists.php.net to get a copy of this message
ID: 44567 Updated by: felipe@php.net Reported By: xiezhenye at gmail dot com -Status: Open +Status: Bogus Bug Type: JSON related Operating System: any PHP Version: 5.2.5 New Comment: var_dump($a); Show: array(2) { [0]=> int(1) [2]=> int(3) } Hence, it isn't a bug. Previous Comments: ------------------------------------------------------------------------ [2008-03-30 05:57:57] xiezhenye at gmail dot com Description: ------------ json_encode return unexpected result on uncontinues array. Reproduce code: --------------- $a = array(1,2,3); echo json_encode($a),"\n"; unset($a[1]); echo json_encode($a),"\n"; Expected result: ---------------- [1,2,3] [1,3] Actual result: -------------- [1,2,3] {"0":1,"2":3} ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=44567&edit=1

« previous php.bugs (#123783) next »