andrei Fri Apr 13 21:34:12 2007 UTC
Modified files: (Branch: PHP_5_2)
/php-src/ext/json JSON_parser.c json.c
Log:
Fix processing of control characters; they should be escaped as \u
sequences.
http://cvs.php.net/viewvc.cgi/php-src/ext/json/JSON_parser.c?r1=1.1.2.4&r2=1.1.2.5&diff_format=u
Index: php-src/ext/json/JSON_parser.c
diff -u php-src/ext/json/JSON_parser.c:1.1.2.4
php-src/ext/json/JSON_parser.c:1.1.2.5
--- php-src/ext/json/JSON_parser.c:1.1.2.4 Tue Jul 25 09:06:55 2006
+++ php-src/ext/json/JSON_parser.c Fri Apr 13 21:34:12 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_STRINGL(z, buf.c, buf.len,
1);
+ 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.9.2.13&r2=1.9.2.14&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.9.2.13 php-src/ext/json/json.c:1.9.2.14
--- php-src/ext/json/json.c:1.9.2.13 Thu Apr 12 19:40:38 2007
+++ php-src/ext/json/json.c Fri Apr 13 21:34:12 2007
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: json.c,v 1.9.2.13 2007/04/12 19:40:38 iliaa Exp $ */
+/* $Id: json.c,v 1.9.2.14 2007/04/13 21:34:12 andrei Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -303,7 +303,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