stas            Wed Jan 30 03:17:57 2008 UTC

  Added files:                 (Branch: PHP_5_3)
    /php-src/ext/json/tests     bug43941.phpt 

  Modified files:              
    /php-src/ext/json   json.c utf8_to_utf16.c 
  Log:
  fix #43941: invalid utf-8 not accepted
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.19.2.4&r2=1.9.2.19.2.5&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.9.2.19.2.4 
php-src/ext/json/json.c:1.9.2.19.2.5
--- php-src/ext/json/json.c:1.9.2.19.2.4        Mon Dec 31 07:17:09 2007
+++ php-src/ext/json/json.c     Wed Jan 30 03:17:57 2008
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: json.c,v 1.9.2.19.2.4 2007/12/31 07:17:09 sebastian Exp $ */
+/* $Id: json.c,v 1.9.2.19.2.5 2008/01/30 03:17:57 stas Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -269,8 +269,14 @@
         {
             efree(utf16);
         }
-
-        smart_str_appendl(buf, "\"\"", 2);
+               if(len < 0) {
+                       if(!PG(display_errors)) {
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, 
"Invalid UTF-8 sequence in argument");
+                       }
+               smart_str_appendl(buf, "null", 4);
+               } else {
+               smart_str_appendl(buf, "\"\"", 2);
+               }
         return;
     }
 
http://cvs.php.net/viewvc.cgi/php-src/ext/json/utf8_to_utf16.c?r1=1.1&r2=1.1.4.1&diff_format=u
Index: php-src/ext/json/utf8_to_utf16.c
diff -u php-src/ext/json/utf8_to_utf16.c:1.1 
php-src/ext/json/utf8_to_utf16.c:1.1.4.1
--- php-src/ext/json/utf8_to_utf16.c:1.1        Tue Jan 31 08:59:06 2006
+++ php-src/ext/json/utf8_to_utf16.c    Wed Jan 30 03:17:57 2008
@@ -40,7 +40,7 @@
     for (;;) {
         c = utf8_decode_next(&utf8);
         if (c < 0) {
-            return UTF8_END ? the_index : UTF8_ERROR;
+            return (c == UTF8_END) ? the_index : UTF8_ERROR;
         }
         if (c < 0x10000) {
             w[the_index] = (unsigned short)c;

http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug43941.phpt?view=markup&rev=1.1
Index: php-src/ext/json/tests/bug43941.phpt
+++ php-src/ext/json/tests/bug43941.phpt

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

Reply via email to