scottmac                                 Tue, 06 Jul 2010 17:01:30 +0000

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

Log:
Fix bug #52262 - Invalid UTF-8 documents don't set an error code when they fail 
to decode.

Bug: http://bugs.php.net/52262 (Assigned) json_decode reports no error while 
returning NULL
      
Changed paths:
    U   php/php-src/branches/PHP_5_3/NEWS
    U   php/php-src/branches/PHP_5_3/ext/json/json.c
    U   php/php-src/trunk/ext/json/json.c

Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS   2010-07-06 16:09:43 UTC (rev 301027)
+++ php/php-src/branches/PHP_5_3/NEWS   2010-07-06 17:01:30 UTC (rev 301028)
@@ -1,6 +1,8 @@
 PHP                                                                        NEWS
 |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
 ?? Jul 2010, PHP 5.3.3 RC3
+- Fixed bug #52262 (json_decode() shows no errors on invalid UTF-8).
+  (Scott)
 - Fixed bug #52240 (hash_copy() does not copy the HMAC key, causes wrong
   results and PHP crashes). (Felipe)
 - Fixed bug #52238 (Crash when an Exception occured in iterator_to_array).

Modified: php/php-src/branches/PHP_5_3/ext/json/json.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/json/json.c        2010-07-06 16:09:43 UTC 
(rev 301027)
+++ php/php-src/branches/PHP_5_3/ext/json/json.c        2010-07-06 17:01:30 UTC 
(rev 301028)
@@ -500,6 +500,7 @@
                if (utf16) {
                        efree(utf16);
                }
+               JSON_G(error_code) = PHP_JSON_ERROR_UTF8;
                RETURN_NULL();
        }


Modified: php/php-src/trunk/ext/json/json.c
===================================================================
--- php/php-src/trunk/ext/json/json.c   2010-07-06 16:09:43 UTC (rev 301027)
+++ php/php-src/trunk/ext/json/json.c   2010-07-06 17:01:30 UTC (rev 301028)
@@ -560,6 +560,7 @@
                if (utf16) {
                        efree(utf16);
                }
+               JSON_G(error_code) = PHP_JSON_ERROR_UTF8;
                RETURN_NULL();
        }


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

Reply via email to