PHP NEWS
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
?? ??? 2007, PHP 5.2.1
+- Fixed bug #38680 (Added missing handling of basic types in json_decode).
+ (Ilia)
02 Nov 2006, PHP 5.2.0
- Updated bundled OpenSSL to version 0.9.8d in the Windows distro. (Edin)
}
else
{
+ double d;
+ int type;
+ long p;
+
zval_dtor(z);
FREE_ZVAL(z);
efree(utf16);
- RETURN_NULL();
+
+ if (parameter_len == 4) {
+ if (!strcasecmp(parameter, "null")) {
+ RETURN_NULL();
+ } else if (!strcasecmp(parameter, "true")) {
+ RETURN_BOOL(1);
+ }
+ } else if (parameter_len == 5 && !strcasecmp(parameter, "false")) {
+ RETURN_BOOL(0);
+ }
+ if ((type = is_numeric_string(parameter, parameter_len, &p, &d, 0)) != 0) {
+ if (type == IS_LONG) {
+ RETURN_LONG(p);
+ } else if (type == IS_DOUBLE) {
+ RETURN_DOUBLE(d);
+ }
+ }
+ if (*parameter == '"' && parameter[parameter_len-1] == '"') {
+ RETURN_STRINGL(parameter+1, parameter_len-2, 1);
+ } else if (*parameter == '{' || *parameter == '[') { /* invalid JSON string */
+ RETURN_NULL();
+ } else {
+ RETURN_STRINGL(parameter, parameter_len, 1);
+ }
}
}
--EXPECT--
Testing: "A JSON payload should be an object or array, not a string."
AS OBJECT
-NULL
+string(58) "A JSON payload should be an object or array, not a string."
AS ARRAY
-NULL
+string(58) "A JSON payload should be an object or array, not a string."
Testing: ["Unclosed array"
AS OBJECT
NULL
AS OBJECT
NULL
AS ARRAY
-NULL
+NULL
\ No newline at end of file