1
0
mirror of https://github.com/php/php-src.git synced 2026-04-21 15:08:16 +02:00
Commit Graph

124 Commits

Author SHA1 Message Date
johannes bcc87ba68e Revert change 3f3ad30c50: There shouldn't be new features in 5.3, especially
not if they aren't in 5.4, too.
2012-07-05 00:55:47 +02:00
Nikita Popov 250393f925 Revert JSON changes to PHP 5.3
This reverts the following commits:

974324676b
4662151ea7
84fe2cc890

This does not revert the JSON changes released in PHP 5.3.14.
2012-07-01 16:28:57 +02:00
Nikita Popov 974324676b Add json_last_error_msg() function
This replaces json_last_error(true) and is consistent with other custom
error handling functions.
2012-06-28 20:11:27 +02:00
Nikita Popov 4662151ea7 Improve JSON error handling
json_encode() no longer throws warnings. Instead only the error code for
json_last_error() is set.

As it is hard to debug the error from just an error code an optional
$as_string parameter was added to json_last_error(), which returns an
error message instead of an error code.
2012-06-27 12:21:48 +02:00
Nikita Popov 84fe2cc890 Improve json_encode error handling
json_encode() now returns bool(false) for all possible errors, throws the
respective warning and also sets the respective json_last_error() error
code. Three new error codes have been added:

  * JSON_ERROR_RECURSION
  * JSON_ERROR_INF_OR_NAN
  * JSON_ERROR_UNSUPPORTED_TYPE

To get a partial JSON output instead of bool(false) the option
JSON_PARTIAL_OUTPUT_ON_ERROR can be specified. In this case the invalid
segments will be replaced either by null (for recursion, unsupported type
and invalid JSON) or 0 (for Inf and NaN).

The warning for invalid UTF-8 stays intact and is thrown also with
display_errors = On. If this behavior is undesired this can be remedied
later.
2012-06-23 20:51:52 +02:00
Adam Harvey 3f3ad30c50 Fix bug #61537 (json_encode() incorrectly truncates/discards information) and
remove a test case that's now mooted by this fix.
2012-04-11 08:24:38 +08:00
Matt Nowack 76ef76d2f8 Adding Braces in json.c to conform with coding standards 2012-03-20 17:29:04 +01:00
Felipe Pena e4ca0ed09f - Year++ 2012-01-01 13:15:04 +00:00
Ilia Alshanetsky 199b52c1d4 Fixed bug #55543 (json_encode() with JSON_NUMERIC_CHECK fails on objects with numeric string properties) 2011-10-17 23:51:25 +00:00
Felipe Pena 23e438594d - Make usage of new PHP_FE_END macro 2011-07-25 11:42:53 +00:00
Christopher Jones 52cc62d825 Remove duplicate lines present in PHP_5_3's .phpt (dtajchreber) 2011-06-17 21:42:40 +00:00
Ilia Alshanetsky f4f2aa7583 Fixed bug #54484 (Empty string in json_decode doesn't reset json_last_error()). 2011-06-01 09:44:38 +00:00
Scott MacVicar 3242016f28 Fix Bug #54058, invalid utf-8 doesn't set json_encode() in all cases 2011-02-21 08:09:02 +00:00
Scott MacVicar 9b567fea6a Fix Bug #53963, error code isn't always set in certain error cases. 2011-02-09 08:05:00 +00:00
Felipe Pena 927bf09c29 - Year++ 2011-01-01 02:19:59 +00:00
Adam Harvey 1f06a6a4e8 Fix English in the error message emitted when json_decode() is called with
depth <= 0.
2010-09-14 03:46:28 +00:00
Scott MacVicar e1ce0a64ea Fix bug #52262 - Invalid UTF-8 documents don't set an error code when they fail to decode. 2010-07-06 17:01:30 +00:00
Ilia Alshanetsky ea3a6539dc Added support for JSON_NUMERIC_CHECK option in json_encode() that converts
numeric strings to integers.
2010-05-20 19:37:52 +00:00
Felipe Pena 45c090f3e7 - Fixed bug #51590 (JSON_ERROR_UTF8 is undefined) 2010-04-18 18:07:27 +00:00
Felipe Pena 4d571dee74 - Fixed tests 2010-04-03 15:42:42 +00:00
Sebastian Bergmann 9ba1e81665 sed -i "s#1997-2009#1997-2010#g" **/*.c **/*.h **/*.php 2010-01-03 09:23:27 +00:00
Rasmus Lerdorf 8af64e6f34 Fix broken json tests in all branches 2009-08-03 04:01:57 +00:00
Scott MacVicar 87dbefa03b MFH: Add error constant when json_encode detects an invalid UTF-8 sequence. 2009-07-27 03:43:38 +00:00
Alexey Zakhlestin 3e326b91e7 fix tests corrupted by svn's eol-style=native 2009-07-15 13:44:14 +00:00
Stanislav Malyshev 2361b4ea2a fix json shared build on Windows 2009-06-30 17:52:21 +00:00
Felipe Pena caf8d811ef - MFH: Fixed memleak when depth arg is less than zero 2009-06-24 17:39:52 +00:00
Johannes Schlüter 96d5c5e931 The json header should be installed so other exts can use it 2009-06-23 13:09:34 +00:00
andy wharmby a6735b8b24 New json extension tests. Tested on Windows, Linux and Linux 64 bit. 2009-06-14 12:08:27 +00:00
Andrei Zmievski 77beb62c5f Fix the build. 2009-05-31 18:55:10 +00:00
Jani Taskinen 7012d0967c MFH: no dots in errors 2009-05-31 13:51:08 +00:00
Andrei Zmievski efc0927f4f Expose encode/decode API. 2009-05-31 01:44:07 +00:00
Kalle Sommer Nielsen 9e230424b5 Cast to unsigned char to prevent compiler warning 2009-05-19 16:06:00 +00:00
Kalle Sommer Nielsen 105272bdec MFH: Fix arginfo 2009-05-15 09:10:55 +00:00
Scott MacVicar d2a7785878 MFH Allow a custom recursion depth to be specified for json_decode() 2009-05-14 22:02:08 +00:00
Scott MacVicar f6dceb637b Rebuild credits, was missed in previous RC 2009-04-02 09:18:00 +00:00
Matt Wilmas 91d325dd72 MFH: Avoid 2 conversions when decoding numbers 2009-03-19 19:26:00 +00:00
Scott MacVicar a23b4073e8 MFH Missing skip in tests 2009-03-17 23:31:14 +00:00
Scott MacVicar c2b15e947d MFH Replace magic values with a define for json encoding, makes reading it a bit easier 2009-03-17 23:26:02 +00:00
Scott MacVicar 8d2a5cabec MFH Add PHP_JSON_FORCE_OBJECT for forcing an object output of an array 2009-03-17 23:15:40 +00:00
Scott MacVicar 3a0c86327f MFH Deal with overflow when decoding large numbers 2009-03-17 14:57:39 +00:00
Scott MacVicar 07e675cc52 MFH Fix bug #47644 - Valid integers are truncated with json_decode() 2009-03-17 02:00:13 +00:00
andy wharmby b2f1d92674 Fix tests. Add missing SKIPIF. Tested on Windows, Linux and Linux 64 2009-01-23 20:23:29 +00:00
Scott MacVicar 6fe58b3542 Fix test again... 2009-01-08 14:09:49 +00:00
Scott MacVicar b08ceb79b3 Fix broken test 2009-01-08 13:35:58 +00:00
Scott MacVicar 0bdbc4e356 MFH Fix bug #46944 - UTF-8 characters outside the BMP aren't encoded correctly. 2009-01-02 03:02:22 +00:00
Sebastian Bergmann 08659c2dcd MFH: Bump copyright year, 3 of 3. 2008-12-31 11:15:49 +00:00
Scott MacVicar 7fe245af85 MFH Make sure we clear out the error when the scalar version decoding works. 2008-12-24 18:09:09 +00:00
Scott MacVicar fdf2d1e46f MFH Add json_last_error() for getting a bit of information about what failed during a decode, also fixes a segfault when we have [1}
[DOC]
2008-12-19 02:00:57 +00:00
Scott MacVicar 6393540c75 MFH Fix Windows build 2008-12-17 15:46:21 +00:00
Scott MacVicar e5587ee4cc MFH Test for bug #45791 2008-12-17 14:46:47 +00:00