Nikita Popov
405ebfcd18
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Add json_last_error_msg() function
2012-06-28 20:18:19 +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
d372b33c9b
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Improve JSON error handling
Conflicts:
ext/json/tests/bug54058.phpt
ext/json/tests/bug61537.phpt
2012-06-27 12:28:55 +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
36fa17a5fa
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Improve json_encode error handling
- BFN
Conflicts:
ext/json/json.c
2012-06-23 21:14:45 +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
Stanislav Malyshev
d84fa39667
Revert "Update test to fix breakage caused by the previous commit."
...
This reverts commit 05c8d4766c
.
Connected to revert 7bbd5521d2
.
2012-05-15 23:25:06 -07:00
Felipe Pena
92bc49b2b0
- Fixed bug #61978 (Object recursion not detected for classes that implement JsonSerializable)
2012-05-08 21:05:51 -03:00
Stanislav Malyshev
7bbd5521d2
Revert "Fix bug #61537 (json_encode() incorrectly truncates/discards information) and"
...
This reverts commit cb2a1c71c9
.
The fix is not correct, not fixed after discussion on github.
Please fix the issues and reapply the patch
2012-05-01 23:54:10 -07:00
Adam Harvey
05c8d4766c
Update test to fix breakage caused by the previous commit.
2012-04-11 08:29:39 +08:00
Adam Harvey
cb2a1c71c9
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:29:39 +08: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
David Soria Parra
71d894cd42
Merge branch 'PHP-5.3' into PHP-5.4
...
* PHP-5.3:
Adding Braces in json.c to conform with coding standards
2012-03-20 17:29:20 +01: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
Felipe Pena
4e19825281
- 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
Ilia Alshanetsky
d4ae4e79db
Fixed bug #55543 (json_encode() with JSON_NUMERIC_CHECK fails on objects with numeric string properties)
2011-10-17 23:51:25 +00:00
Gwynne Raskind
81ee8a6c7b
Add test for #53946 to 5.4 (missed it when committing revision 315707)
2011-08-29 14:57:53 +00:00
Gwynne Raskind
06292974b1
Add unescaped Unicode encoding to json_encode(). Closes bug #53946 . Patch by Irker and Gwynne.
2011-08-29 14:56:19 +00:00
Felipe Pena
783b05326a
- Added missing PHP_FE_END/ZEND_FE_END
2011-08-06 01:22:27 +00:00
Felipe Pena
23e438594d
- Make usage of new PHP_FE_END macro
2011-07-25 11:42:53 +00:00
Felipe Pena
4b30846b50
- Make usage of new PHP_FE_END macro
2011-07-25 11:35:02 +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
Ilia Alshanetsky
a7dfb31557
Fixed bug #54484 (Empty string in json_decode doesn't reset json_last_error()).
2011-06-01 09:44:38 +00:00
Peter Cowburn
e77bd31f3f
fix method name in JsonSerializable exception message
2011-04-30 12:57:23 +00:00
Scott MacVicar
ecb9d8019c
Fix Bug #54058 , invalid utf-8 doesn't set json_encode() in all cases
2011-02-21 08:09:02 +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
Scott MacVicar
18b7f018e3
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
Felipe Pena
0203cc3d44
- Year++
2011-01-01 02:17:06 +00:00
Pierre Joye
a7ffa09e18
- add PHP_INSTALL_HEADERS to all parts (core&exts) exposing headers, generate the install-headers cmd
2010-12-11 22:18:10 +00:00
Adam Harvey
cb9c8233fc
Implement FR #44331 (Formatting option for json_encode). Bikeshedding about the
...
exact form of the JSON pretty printing and brace handling will only be accepted
in the form of patches. ;)
2010-09-16 16:21:15 +00:00
Adam Harvey
d8b8d22a0d
Rebalance the folds in json.c.
2010-09-16 14:15:19 +00:00
Adam Harvey
726fe638bb
Implemented FR #49366 (Make slash escaping optional in json_encode()).
2010-09-16 13:53:27 +00:00
Adam Harvey
3c93eab5a3
Fix English in the error message emitted when json_decode() is called with
...
depth <= 0.
2010-09-14 03:46:28 +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
Scott MacVicar
bc74861cf8
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
Sara Golemon
a0269a6a72
Ooops, return values...
2010-05-21 23:29:34 +00:00
Sara Golemon
6eb4218433
Add JSON_BIGINT_AS_STRING for json_decode() to parse large numbers
...
as strings rather than casting to double and loosing precision.
2010-05-21 22:59:58 +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
Ilia Alshanetsky
cf174c1366
Added support for JSON_NUMERIC_CHECK option in json_encode() that converts
...
numeric strings to integers.
2010-05-20 19:37:52 +00:00
Sara Golemon
1fd85e29de
Rename JSON_Serializable to JsonSerializable per ML discussion
2010-05-12 16:42:48 +00:00
Kalle Sommer Nielsen
a31a2083af
Well we do need zend_throw_exception_ex ;-)
2010-05-06 13:44:35 +00:00
Sara Golemon
1381b14eaa
Add JSON_Serializable interface
...
Objects implementing JSON_Serializable will have
their ->jsonSerialize() method called
Similar to serialize() and __sleep()
2010-05-05 22:48:14 +00:00
Rob Richards
0a34d10783
revert change #298288 : Remove old dsp/dsw/makefile files
2010-04-28 14:41:51 +00:00
Kalle Sommer Nielsen
518a17e7bf
Remove old dsp/dsw/makefile files, these arent used by the build system anymore and are barely updated nor available for all extensions
2010-04-21 23:36:49 +00:00
Felipe Pena
45c090f3e7
- Fixed bug #51590 (JSON_ERROR_UTF8 is undefined)
2010-04-18 18:07:27 +00:00
Felipe Pena
6f03cbf664
- Fixed bug #51590 (JSON_ERROR_UTF8 is undefined)
2010-04-18 18:07:27 +00:00
Felipe Pena
a90c801c2f
- Fixed tests
2010-04-03 15:42:42 +00:00
Felipe Pena
4d571dee74
- Fixed tests
2010-04-03 15:42:42 +00:00
Johannes Schlüter
26b08f9857
Remove main/php3_compat.h, for that a few references to function_entry
have
...
to be replaced by `zend_function_entry`.
2010-03-30 23:03:02 +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
Scott MacVicar
8ef7fe1d99
Update the JSON parser with that on json.org, biggest change here is code readability. Less magic numbers in the state table.
...
Add missing reflection information to json_encode()
Fixes bug #45791 with 0e0 not being supported as a value
Error values are stored when encountered during parsing
2008-12-17 14:40:06 +00:00
Scott MacVicar
ed5f04710b
MFH Fix bug #45989 - json_decode() doesn't return NULL on certain invalid strings
2008-12-12 23:19:47 +00:00
Matt Wilmas
d5295fc9c8
MFH: Changed logic for LONG_MIN
2008-12-02 14:50:22 +00:00
Felipe Pena
83c0eb69ad
- Fixed tests
2008-11-19 16:58:28 +00:00
Felipe Pena
fc2fb50d09
- MFH: Added 'static' into ZEND_BEGIN_ARG_INFO_EX macro
2008-11-17 11:28:01 +00:00
Felipe Pena
7a37fa2d6b
- Revert ZEND_BEGIN_ARG_INFO change
2008-11-02 21:19:39 +00:00
Felipe Pena
df10005563
- MFH: Added 'static' into ZEND_BEGIN_ARG_INFO_EX macro
2008-10-24 14:35:40 +00:00
Felipe Pena
3ecc545018
- New test
2008-10-02 03:36:52 +00:00
Felipe Pena
604c7f6ad2
- MFH: Fixed bug #46215 (json_encode mutates its parameter and has some class-specific state)
2008-10-02 03:36:20 +00:00
Rasmus Lerdorf
c6671a0596
Fix test to test higher nesting level
2008-07-31 11:46:23 +00:00
Rasmus Lerdorf
2f469e8c15
We can afford a larger stack here and other json parsers out there
...
go deeper than 128.
2008-07-30 13:52:59 +00:00
Jani Taskinen
4e2ed54d15
ws + cs
2008-07-22 15:30:03 +00:00
Jani Taskinen
7e67bc4e80
MFH: unused stuff
2008-07-22 14:57:46 +00:00
Felipe Pena
cb0d08699d
- Added arginfo
2008-06-27 19:16:17 +00:00
Antony Dovgal
0c01626f1c
MFH
2008-02-15 09:20:25 +00:00
Dmitry Stogov
1a41611372
ZTS fix
2008-01-30 08:10:17 +00:00
Stanislav Malyshev
b4443f35ff
fix #43941 : invalid utf-8 not accepted
2008-01-30 03:17:57 +00:00
Nuno Lopes
61eb7ae554
remove unused PHP_EXTNAME_API macros.
...
#in preparation for the gcc 4 visibility patch
2008-01-03 16:20:33 +00:00
Sebastian Bergmann
d1dded8751
MFH: Bump copyright year, 2 of 2.
2007-12-31 07:17:19 +00:00
Dmitry Stogov
ebf4cd30db
Fixed test related to bug #38469
2007-12-28 13:23:00 +00:00
Sara Golemon
cce03434ef
MFH (json.c r-1.32) Add support for encoding options
2007-12-17 07:48:27 +00:00
Yiduo (David) Wang
4b4d634cb9
MFH: Added macros for managing zval refcounts and is_ref statuses
2007-10-07 05:22:07 +00:00
Ilia Alshanetsky
c3cf6cb069
Added test for bug #42785
2007-10-01 15:33:11 +00:00
Ilia Alshanetsky
36cf6a2b05
Fixed bug #42785 (json_encode() formats doubles according to locale rather
...
then following standard syntax).
2007-10-01 15:22:41 +00:00
Dmitry Stogov
6c810b0d4c
Improved memory usage by movig constants to read only memory. (Dmitry, Pierre)
2007-09-27 18:00:48 +00:00
Hannes Magnusson
e3b8cf0f66
MFH: Fixed bug#42090 (json_decode causes segmentation fault)
2007-07-24 22:57:13 +00:00
Antony Dovgal
17ee976404
fix ws/folding
2007-07-23 12:24:52 +00:00
foobar
7ed3c4536d
MFH: Fix some configure --help texts
2007-07-03 17:25:43 +00:00
foobar
a074d2d66b
typo
2007-06-29 14:01:11 +00:00
foobar
0f15eeda46
oops
2007-06-29 14:00:21 +00:00
foobar
ad0beee01f
- Added missing SKIPIFs
2007-06-29 13:51:27 +00:00
Ilia Alshanetsky
c969e9005b
Handle very small longs via double
2007-06-13 17:56:41 +00:00
Ilia Alshanetsky
9f28e21bb1
Fixed bug #41673 (json_encode breaks large numbers in arrays).
2007-06-13 17:07:58 +00:00
Ilia Alshanetsky
3b61fd8286
Update test
2007-06-11 15:07:40 +00:00
Antony Dovgal
76065b520a
adjust test for 64bit
2007-06-08 08:40:28 +00:00
Antony Dovgal
e5be1f55ad
fix test, add 64bit version
2007-06-08 08:34:48 +00:00
Ilia Alshanetsky
045b283a7d
Fixed bug #41567 (json_encode() double conversion is inconsistent with PHP).
2007-06-04 23:51:32 +00:00
Ilia Alshanetsky
47216d7de4
Adjust tests to reflect the new expected output
2007-05-27 17:57:57 +00:00
Ilia Alshanetsky
faae3e9ecf
Fixed bug #41504 (json_decode() incorrectly decodes JSON arrays with empty
...
string keys).
2007-05-27 16:31:35 +00:00
Hannes Magnusson
de4408c9af
MFH: protos (patch by jeffg at activestate dot com)
2007-05-25 13:24:50 +00:00
Hannes Magnusson
ad57583ba4
This test should only test failures
2007-05-25 12:31:03 +00:00
Hannes Magnusson
993b66b4c8
Fix test after stack limit bump
2007-05-25 12:15:38 +00:00
Rasmus Lerdorf
c7069887a4
Make the code match the commit comment
2007-05-24 22:40:02 +00:00
Rasmus Lerdorf
464d87e58b
I don't see any reason to leave the stack limitation at 20. We have
...
reports of this limit being hit now and as far as I can tell bumping it
to 128 isn't going break anything in the parser code.
2007-05-24 22:37:59 +00:00
Antony Dovgal
09a575a20f
MFH: fix #41403 (json_decode cannot decode floats if localeconv decimal_point is not '.')
2007-05-16 12:54:30 +00:00
Antony Dovgal
66859a74de
fix tests
2007-04-26 23:30:00 +00:00
Antony Dovgal
cb81428054
apply correct fix
2007-04-20 10:16:46 +00:00
Antony Dovgal
8deb6294ec
fix test
2007-04-20 10:15:04 +00:00
Ilia Alshanetsky
8b245e5aaf
Fixed bug #41067 (json_encode() problem with UTF-16 input).
2007-04-16 22:31:05 +00:00
Antony Dovgal
7a6e0a1dd2
fix test
2007-04-16 09:11:10 +00:00
Andrei Zmievski
b62d120580
Fix processing of control characters; they should be escaped as \u
...
sequences.
2007-04-13 21:34:12 +00:00
Ilia Alshanetsky
a133297c86
Fixed bug #41034 (json_encode() ignores null byte started keys in arrays)
2007-04-12 19:40:38 +00:00
Ilia Alshanetsky
5e274ea47d
Fixed bug #40503 (json_encode() value corruption on 32bit systems with
...
overflown values).
2007-02-18 16:54:59 +00:00
Antony Dovgal
e8d2c9489d
MFH: nuke skeleton leftovers
2007-01-12 12:17:32 +00:00
Sebastian Bergmann
4223aa4d5e
MFH: Bump year.
2007-01-01 09:36:18 +00:00
Ilia Alshanetsky
7efb0a14f4
Use safe_emalloc()
2006-12-25 21:41:04 +00:00
Nuno Lopes
078fda3d6e
remove NOP code in json_determine_array_type(), as we already know the zval passed is an array (based on patch by Ron Korving)
2006-12-19 15:01:05 +00:00
Ilia Alshanetsky
57f295d3a6
Fixed bug #38680 (Added missing handling of basic types in json_decode).
...
# already in HEAD
2006-11-03 13:16:33 +00:00
Dmitry Stogov
3b2fa0ce82
Fix memory leaks
2006-09-13 13:25:50 +00:00
Nuno Lopes
ddb4d1fdcc
move static declaration to *.c files
...
mroe static/const keywording
2006-08-14 20:08:18 +00:00
Marcus Boerger
efc6ff0c39
- Test name must not be more than a single line
2006-08-07 23:28:05 +00:00
Antony Dovgal
cff6e2b446
initialize variable
2006-07-25 09:06:55 +00:00
Rob Richards
40e08311e5
MFH: enable by default
2006-07-22 15:33:02 +00:00
Nuno Lopes
ff591e2cf0
more const keywording
2006-07-22 15:22:56 +00:00
Antony Dovgal
f59a139f61
rephrase
2006-07-20 10:47:37 +00:00
foobar
68ae270793
MFH: simplify
2006-07-20 10:11:15 +00:00
foobar
479055a85b
MFH
2006-07-20 10:07:29 +00:00
Antony Dovgal
3003cd2473
MFH: use E_WARNING on recursion and add null to the result to keep it valid
2006-07-20 09:33:28 +00:00
Antony Dovgal
60720d285f
MFH: ZTS fix
2006-07-20 09:19:02 +00:00
Antony Dovgal
3e308d3a6b
MFH: add recursion protection to json_encode() and new tests
2006-07-20 08:56:57 +00:00
Antony Dovgal
0b97d2bd60
fix segfault, add test
2006-07-20 08:24:31 +00:00
Antony Dovgal
074feedc2b
MFH
2006-07-20 07:40:49 +00:00
Ilia Alshanetsky
cdfe00b801
Fixed compiler warnings and enable Json by default.
2006-07-19 16:17:15 +00:00
SVN Migration
608baa409a
This commit was manufactured by cvs2svn to create branch 'PHP_5_2'.
2006-05-05 15:49:42 +00:00