scottmac Fri Dec 12 23:19:47 2008 UTC
Modified files: (Branch: PHP_5_3)
/php-src/ext/json json.c
/php-src/ext/json/tests 001.phpt bug42090.phpt
Log:
MFH Fix bug #45989 - json_decode() doesn't return NULL on certain invalid
strings
http://cvs.php.net/viewvc.cgi/php-src/ext/json/json.c?r1=1.9.2.19.2.12&r2=1.9.2.19.2.13&diff_format=u
Index: php-src/ext/json/json.c
diff -u php-src/ext/json/json.c:1.9.2.19.2.12
php-src/ext/json/json.c:1.9.2.19.2.13
--- php-src/ext/json/json.c:1.9.2.19.2.12 Mon Nov 17 11:27:56 2008
+++ php-src/ext/json/json.c Fri Dec 12 23:19:47 2008
@@ -16,7 +16,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: json.c,v 1.9.2.19.2.12 2008/11/17 11:27:56 felipe Exp $ */
+/* $Id: json.c,v 1.9.2.19.2.13 2008/12/12 23:19:47 scottmac Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -523,13 +523,7 @@
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);
- }
+ RETURN_NULL();
}
}
/* }}} */
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/001.phpt?r1=1.1.2.4&r2=1.1.2.4.2.1&diff_format=u
Index: php-src/ext/json/tests/001.phpt
diff -u php-src/ext/json/tests/001.phpt:1.1.2.4
php-src/ext/json/tests/001.phpt:1.1.2.4.2.1
--- php-src/ext/json/tests/001.phpt:1.1.2.4 Fri Nov 3 13:16:33 2006
+++ php-src/ext/json/tests/001.phpt Fri Dec 12 23:19:47 2008
@@ -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"]=>
http://cvs.php.net/viewvc.cgi/php-src/ext/json/tests/bug42090.phpt?r1=1.1.2.2.2.1&r2=1.1.2.2.2.2&diff_format=u
Index: php-src/ext/json/tests/bug42090.phpt
diff -u php-src/ext/json/tests/bug42090.phpt:1.1.2.2.2.1
php-src/ext/json/tests/bug42090.phpt:1.1.2.2.2.2
--- php-src/ext/json/tests/bug42090.phpt:1.1.2.2.2.1 Fri Feb 15 09:20:25 2008
+++ php-src/ext/json/tests/bug42090.phpt Fri Dec 12 23:19:47 2008
@@ -16,10 +16,9 @@
?>
--EXPECT--
string(0) ""
-string(5) "".."."
-string(1) """
-string(2) """"
+NULL
+NULL
+NULL
string(4) ""\"""
string(1) """
string(2) """"
-
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php