Bug #54484 [Csd->ReO]: Empty string in json_decode doesn't set/reset json_last_error

From: Date: Mon, 22 Oct 2012 02:35:54 +0000
Subject: Bug #54484 [Csd->ReO]: Empty string in json_decode doesn't set/reset json_last_error
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-174215@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=54484&edit=1 ID: 54484 Updated by: aharvey@php.net Reported by: wildcat at the-wildcat dot de Summary: Empty string in json_decode doesn't set/reset json_last_error -Status: Closed +Status: Re-Opened Type: Bug Package: JSON related Operating System: Linux PHP Version: 5.3.6 -Assigned To: iliaa +Assigned To: aharvey Block user comment: N Private report: N New Comment: I don't think the above commit fixed the entire issue: it ensures that the error state is reset to 0 when json_decode() is called, but doesn't deal with actually setting an error state when we return NULL due to an empty string (which I agree should result in a syntax error state). Assigning to self. Previous Comments: ------------------------------------------------------------------------ [2012-07-24 23:41:28] rasmus@php.net Automatic comment on behalf of iliaa Revision: http://git.php.net/?p=php-src.git;a=commit;h=850db4b315eb56d261098a6f42df6a8375cbd937 Log: Fixed bug #54484 (Empty string in json_decode doesn't reset json_last_error()). ------------------------------------------------------------------------ [2012-04-18 09:50:23] laruence@php.net Automatic comment on behalf of iliaa Revision: http://git.php.net/?p=php-src.git;a=commit;h=850db4b315eb56d261098a6f42df6a8375cbd937 Log: Fixed bug #54484 (Empty string in json_decode doesn't reset json_last_error()). ------------------------------------------------------------------------ [2011-06-01 11:44:51] iliaa@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. ------------------------------------------------------------------------ [2011-06-01 11:44:40] iliaa@php.net Automatic comment from SVN on behalf of iliaa Revision: http://svn.php.net/viewvc/?view=revision&revision=311708 Log: Fixed bug #54484 (Empty string in json_decode doesn't reset json_last_error()). ------------------------------------------------------------------------ [2011-04-08 08:20:41] scottmac@php.net a string of length 0 skips the decoder and returns null. I'm thinking it should set the error code to 4 so I'll fix it to do so. ------------------------------------------------------------------------ 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=54484 -- Edit this bug report at https://bugs.php.net/bug.php?id=54484&edit=1

« previous php.bugs (#174215) next »