andrei          Mon Apr 16 16:52:21 2007 UTC

  Modified files:              
    /php-src/ext/json   JSON_parser.c json.c 
  Log:
  MFB (handling of control characters)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/json/JSON_parser.c?r1=1.7&r2=1.8&diff_format=u
Index: php-src/ext/json/JSON_parser.c
diff -u php-src/ext/json/JSON_parser.c:1.7 php-src/ext/json/JSON_parser.c:1.8
--- php-src/ext/json/JSON_parser.c:1.7  Wed Oct 18 07:41:33 2006
+++ php-src/ext/json/JSON_parser.c      Mon Apr 16 16:52:20 2007
@@ -169,7 +169,7 @@
     accepted if the end of the text is in state 9 and mode is MODE_DONE.
 */
 static const int state_transition_table[30][31] = {
-/* 0*/ { 0, 
0,-8,-1,-6,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
+/* 0*/ { 0, 0,-8,-1,-6,-1,-1,-1, 
3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
 /* 1*/ { 1, 1,-1,-9,-1,-1,-1,-1, 
3,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1},
 /* 2*/ { 2, 2,-8,-1,-6,-5,-1,-1, 
3,-1,-1,-1,20,-1,21,22,-1,-1,-1,-1,-1,13,-1,17,-1,-1,10,-1,-1,-1,-1},
 /* 3*/ { 3,-1, 3, 3, 3, 3, 3, 3,-4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 
3, 3, 3, 3, 3, 3, 3, 3},
@@ -577,6 +577,14 @@
                 case MODE_OBJECT:
                     the_state = 9;
                     break;
+                               case MODE_DONE:
+                                       if (type == IS_STRING) {
+                                               smart_str_0(&buf);
+                                               ZVAL_UTF8_STRINGL(z, buf.c, 
buf.len, ZSTR_DUPLICATE);
+                                               the_state = 9;
+                                               break;
+                                       }
+                                       /* fall through if not IS_STRING */
                 default:
                     FREE_BUFFERS();
                     return false;
http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.23&r2=1.24&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.23 php-src/ext/json/json.c:1.24
--- php-src/ext/json/json.c:1.23        Mon Feb 19 19:44:44 2007
+++ php-src/ext/json/json.c     Mon Apr 16 16:52:20 2007
@@ -16,7 +16,7 @@
   +----------------------------------------------------------------------+
 */
 
-/* $Id: json.c,v 1.23 2007/02/19 19:44:44 tony2001 Exp $ */
+/* $Id: json.c,v 1.24 2007/04/16 16:52:20 andrei Exp $ */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
@@ -307,7 +307,7 @@
                 break;
             default:
                 {
-                    if (us < ' ' || (us & 127) == us)
+                    if (us >= ' ' && (us & 127) == us)
                     {
                         smart_str_appendc(buf, (unsigned char) us);
                     }

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

Reply via email to