Index: ext/json/json.c =================================================================== RCS file: /repository/php-src/ext/json/json.c,v retrieving revision 1.9.2.19.2.12 diff -u -r1.9.2.19.2.12 json.c --- ext/json/json.c 17 Nov 2008 11:27:56 -0000 1.9.2.19.2.12 +++ ext/json/json.c 3 Dec 2008 21:47:45 -0000 @@ -499,6 +499,7 @@ } else { + /* The JSON parser failed, let's try to parse some common PHP types */ double d; int type; long p; @@ -523,13 +524,8 @@ RETURN_DOUBLE(d); } } - if (str_len > 1 && *str == '"' && str[str_len-1] == '"') { - RETURN_STRINGL(str+1, str_len-2, 1); - } else if (*str == '{' || *str == '[') { /* invalid JSON string */ - RETURN_NULL(); - } else { - RETURN_STRINGL(str, str_len, 1); - } + /* Parsing failed, let's return NULL */ + RETURN_NULL(); } } /* }}} */ Index: ext/json/tests/001.phpt =================================================================== RCS file: /repository/php-src/ext/json/tests/001.phpt,v retrieving revision 1.1.2.4 diff -u -r1.1.2.4 001.phpt --- ext/json/tests/001.phpt 3 Nov 2006 13:16:33 -0000 1.1.2.4 +++ ext/json/tests/001.phpt 3 Dec 2008 21:47:45 -0000 @@ -31,12 +31,12 @@ NULL NULL NULL -string(1) "." -string(1) "." -string(3) "" -string(1) ";" -string(12) "руссиш" -string(4) "blah" +NULL +NULL +NULL +NULL +NULL +NULL NULL object(stdClass)#1 (1) { ["test"]=> Index: ext/json/tests/bug42090.phpt =================================================================== RCS file: /repository/php-src/ext/json/tests/bug42090.phpt,v retrieving revision 1.1.2.2.2.1 diff -u -r1.1.2.2.2.1 bug42090.phpt --- ext/json/tests/bug42090.phpt 15 Feb 2008 09:20:25 -0000 1.1.2.2.2.1 +++ ext/json/tests/bug42090.phpt 3 Dec 2008 21:47:45 -0000 @@ -16,10 +16,9 @@ ?> --EXPECT-- string(0) "" -string(5) "".."." -string(1) """ -string(2) """" +NULL +NULL +NULL string(4) ""\""" string(1) """ string(2) """" -