scottmac                                 Wed, 09 Feb 2011 08:05:00 +0000

Revision: http://svn.php.net/viewvc?view=revision&revision=308155

Log:
Fix Bug #53963, error code isn't always set in certain error cases.

Bug: http://bugs.php.net/53963 (Assigned) Failed to decode, yet 
json_last_error() is JSON_ERROR_NONE
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/json/JSON_parser.c
    U   php/php-src/trunk/ext/json/JSON_parser.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2011-02-09 00:34:12 UTC (rev 308154)
+++ php/php-src/branches/PHP_5_3/NEWS   2011-02-09 08:05:00 UTC (rev 308155)
@@ -75,6 +75,10 @@
   . Implemented clone functionality for number, date & message formatters.
     (Stas).

+- JSON extension:
+  . Fixed bug #53963 (Ensure error_code is always set during some failed
+    decodings). (Scott)
+
 - MySQL Improved extension:
   . Added 'db' and 'catalog' keys to the field fetching functions (FR #39847).
     (Kalle)

Modified: php/php-src/branches/PHP_5_3/ext/json/JSON_parser.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/json/JSON_parser.c 2011-02-09 00:34:12 UTC 
(rev 308154)
+++ php/php-src/branches/PHP_5_3/ext/json/JSON_parser.c 2011-02-09 08:05:00 UTC 
(rev 308155)
@@ -656,6 +656,7 @@
                                        /* fall through if not IS_STRING */
                 default:
                     FREE_BUFFERS();
+                    jp->error_code = PHP_JSON_ERROR_SYNTAX;
                     return false;
                 }
                 break;
@@ -695,6 +696,7 @@
                         break;
                     default:
                         FREE_BUFFERS();
+                        jp->error_code = PHP_JSON_ERROR_SYNTAX;
                         return false;
                 }
                 buf.len = 0;

Modified: php/php-src/trunk/ext/json/JSON_parser.c
===================================================================
--- php/php-src/trunk/ext/json/JSON_parser.c    2011-02-09 00:34:12 UTC (rev 
308154)
+++ php/php-src/trunk/ext/json/JSON_parser.c    2011-02-09 08:05:00 UTC (rev 
308155)
@@ -673,6 +673,7 @@
                                        /* fall through if not IS_STRING */
                 default:
                     FREE_BUFFERS();
+                    jp->error_code = PHP_JSON_ERROR_SYNTAX;
                     return false;
                 }
                 break;
@@ -712,6 +713,7 @@
                         break;
                     default:
                         FREE_BUFFERS();
+                        jp->error_code = PHP_JSON_ERROR_SYNTAX;
                         return false;
                 }
                 buf.len = 0;

-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to