Commit Graph

283 Commits

Author SHA1 Message Date
Jakub Zelenka
9e5f687957 Fix json object decoding 2014-12-12 19:52:45 +00:00
Jakub Zelenka
c6d0905158 Do not copy return_value in parser 2014-12-07 20:27:03 +00:00
Jakub Zelenka
c51ea47996 Change string buffer handling in json scanner 2014-12-03 20:47:52 +00:00
Jakub Zelenka
098097d83f Fix compilation for json scanner 2014-11-30 18:29:48 +00:00
Jakub Zelenka
f18aae6042 Fix compilation for json_encoder 2014-11-30 17:47:17 +00:00
Jakub Zelenka
79e8355631 Fix compilation issues in json_parser 2014-11-26 20:49:55 +00:00
Jakub Zelenka
a4e59c39a7 Add missing bits to php_json.h 2014-11-25 20:36:41 +00:00
Jakub Zelenka
e18dd67975 Move json encoding stuff 2014-11-24 20:46:13 +00:00
Jakub Zelenka
f00b80a511 Implement initial changes for json_parser 2014-11-23 19:53:06 +00:00
Jakub Zelenka
ba70ba5f13 Replace INIT_PZVAL_COPY with ZVAL_DUP 2014-11-16 15:21:01 +00:00
Jakub Zelenka
432b73fdee Add error codes to php_json.h 2014-11-16 15:13:15 +00:00
Jakub Zelenka
d07bf91328 Initial import of jsond 2014-11-13 20:20:46 +00:00
Anatol Belski
7a6a3d923b fix arg order, CFLAGS is the fifth arg in m4 2014-10-17 16:03:40 +02:00
Anatol Belski
fea10f6a5e ext/iconv, ext/json and ext/session use static tsrmls pointer 2014-10-17 14:16:40 +02:00
Nikita Popov
016a96c7c2 Fix ::jsonSerialize() failure message 2014-10-12 20:55:51 +02:00
Anatol Belski
4b3e198023 removed *.dsw and *.dsp files 2014-09-28 19:02:09 +02:00
Nikita Popov
e33f3d3b7c Move smart_str implementation into Zend/
So we can use it there as well...

For now I've retained the zend_smart_str_public.h header, though
it would probably be better to just move that one struct into
zend_types.h.
2014-09-21 20:49:39 +02:00
Nikita Popov
37aaccad7d Use inline functions for most of smart_str
smart_str_free_ex no longer exists, always use smart_str_free instead.

smart_str_alloc no longer requires a newlen variable to be in scope,
instead it returns the new length.
2014-09-19 23:39:07 +02:00
Johannes Schlüter
d0cb715373 s/PHP 5/PHP 7/ 2014-09-19 18:33:14 +02:00
Dmitry Stogov
3bc8a958c5 Fixed useless or duplicated IS_INTERNED() checks 2014-09-19 15:41:01 +04:00
Anatol Belski
19f8217113 reduce struct size by 8 byte on 64 bit 2014-09-17 09:03:47 +02:00
Anatol Belski
232459efd0 fix signature 2014-08-27 22:13:01 +02:00
Anatol Belski
074c68e9ce fix signature 2014-08-27 22:05:26 +02:00
Anatol Belski
6db8d4f829 's' works with size_t round 3 2014-08-27 20:49:36 +02:00
Anatol Belski
3234480827 first show to make 's' work with size_t 2014-08-27 20:49:31 +02:00
Dmitry Stogov
37f9f10f01 Improved performance of json_encode() 2014-08-27 13:37:54 +04:00
Anatol Belski
993ae7e9f6 fix strtol call 2014-08-26 00:25:29 +02:00
Anatol Belski
c3e3c98ec6 master renames phase 1 2014-08-25 19:24:55 +02:00
Anatol Belski
1958857225 ported ext/json 2014-08-19 20:15:59 +02:00
Anatol Belski
63d3f0b844 basic macro replacements, all at once 2014-08-19 08:07:31 +02:00
Lior Kaplan
543d5eb495 Merge branch 'PHP-5.6'
* PHP-5.6:
  typofixes

Conflicts:
	ext/spl/php_spl.c
2014-08-17 15:53:33 +03:00
Lior Kaplan
56d02d564e Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  typofixes
2014-08-17 15:51:15 +03:00
Lior Kaplan
be2128c805 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  typofixes
2014-08-17 15:48:22 +03:00
Veres Lajos
3f42f2f5d1 typofixes 2014-08-17 15:44:02 +03:00
Dmitry Stogov
c1965f58d4 Use reference counting instead of zval duplication 2014-06-05 16:04:11 +04:00
Dmitry Stogov
b3b616cf7e Introduced immutable arrays. They don't need to be copyed and may be used directly from SHM. 2014-05-29 18:21:56 +04:00
Nikita Popov
bfff679d90 Fix length reset in JSON parser 2014-05-29 12:53:32 +02:00
Nikita Popov
4d22be992c Fix ZTS 2014-05-05 17:28:22 +02:00
Xinchen Hui
fa6f6c8807 Fixed Reference handling in xml_parse_into_struct 2014-05-05 19:45:50 +08:00
Nikita Popov
b30c7fe263 Port JSON 2014-05-05 01:00:59 +02:00
Stanislav Malyshev
3970b9d7dd Merge branch 'PHP-5.6'
* PHP-5.6:
  Fix #66021 (Blank line inside empty array/object)
2014-04-13 18:56:26 -07:00
Stanislav Malyshev
7c9209a0d1 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fix #66021 (Blank line inside empty array/object)
2014-04-13 18:56:16 -07:00
Stanislav Malyshev
9bba219c75 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix #66021 (Blank line inside empty array/object)
2014-04-13 18:55:28 -07:00
Stanislav Malyshev
5e66ce9293 Merge branch 'pull-request/518' into PHP-5.4
* pull-request/518:
  Fix #66021 (Blank line inside empty array/object)
2014-04-13 18:50:39 -07:00
Julien Pauli
1ba76df8d0 Export JsonSerializable Interface (bug #65753) 2014-02-17 10:39:39 +01:00
Julien Pauli
8a1d248d4e Export JsonSerializable Interface (bug #65753) 2014-02-17 10:38:51 +01:00
Julien Pauli
baafdad150 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Export JsonSerializable Interface (bug #65753)
2014-02-17 10:36:13 +01:00
Julien Pauli
786234d351 Export JsonSerializable Interface (bug #65753) 2014-02-17 10:25:40 +01:00
Xinchen Hui
0f53e37494 Merge branch 'PHP-5.6' 2014-01-03 11:09:07 +08:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
47c9027772 Bump year 2014-01-03 11:06:16 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
kovacs.ferenc
a833f7d460 Merge branch 'PHP-5.6' 2013-11-18 12:39:40 +01:00
Andrea Faulds
91779db95b Fixed case part of bug #64874 ("json_decode handles whitespace and case-sensitivity incorrectly") 2013-11-11 22:54:16 +00:00
Adam Harvey
91cb087727 Merge branch 'PHP-5.6'
* PHP-5.6:
  Update NEWS and remove the unnecessary UPGRADING note.
  UPGRADING and NEWS
  Better test: Check combined leading/trailing
  Fixed whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitivity incorrectly")
2013-11-10 16:16:38 -05:00
Adam Harvey
304bff90f4 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Update NEWS and remove the unnecessary UPGRADING note.
  UPGRADING and NEWS
  Better test: Check combined leading/trailing
  Fixed whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitivity incorrectly")
2013-11-10 16:11:28 -05:00
Adam Harvey
90d4ae4da8 Make all code paths in json_determine_array_type() return constants.
This is a purely cosmetic change, but the current behaviour of returning
PHP_JSON_OUTPUT_ARRAY and 1 looks weird.
2013-11-09 12:15:37 -05:00
Kevin Israel
82a4f1a1a2 Fix #66021 (Blank line inside empty array/object)
Changed json_encode() so that when the JSON_PRETTY_PRINT option is specified,
the pair of linefeeds immediately after an opening bracket and before the
corresponding closing bracket is omitted when the array or object contains no
elements or accessible properties (and hence would have a blank line between
the brackets).
2013-11-02 15:59:11 -04:00
Andrea Faulds
8495d63034 Better test: Check combined leading/trailing 2013-10-15 20:42:31 +00:00
Andrea Faulds
2524428504 Fixed whitespace part of bug #64874 ("json_decode handles whitespace and case-sensitivity incorrectly") 2013-09-17 19:09:52 +00:00
Veres Lajos
4749457a49 HASH_KEY_NON_EXISTANT fix 2013-07-21 20:09:53 -07:00
Xinchen Hui
a666285bc2 Happy New Year 2013-01-01 16:37:09 +08:00
Xinchen Hui
0a7395e009 Happy New Year 2013-01-01 16:28:54 +08:00
Adam Harvey
8bb106d20c Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Alter php_json_decode_ex() to respect JSON_BIGINT_AS_STRING for bare numbers.
2012-12-11 19:53:02 +08:00
Adam Harvey
2d1694d4eb Alter php_json_decode_ex() to respect JSON_BIGINT_AS_STRING for bare numbers.
Fixes bug #63737 (json_decode does not properly decode with options parameter).
2012-12-11 19:51:30 +08:00
Remi Collet
495ff0964d Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Related bug #63588 fix length computation + optimize for speed
2012-11-26 13:05:37 +01:00
Remi Collet
7751a68824 Related bug #63588 fix length computation + optimize for speed
Following comment from Yoram "The patch looks fine, except of testing
for true value of utf16 in each iteration."
Also fix the length computation during check phase.
2012-11-26 12:59:08 +01:00
Remi Collet
f4a8612561 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fixed bug #63588 Duplicate implementation of php_next_utf8_char
2012-11-25 08:21:10 +01:00
Remi Collet
289bb339c9 Fixed bug #63588 Duplicate implementation of php_next_utf8_char
Json use an utf8 parser from a third party library, switch to
our implementation of php_next_utf8_char.
This also helps on solving #63520. All the unit tests succeed.
Our implementation also seems a little faster.

json.dsp need to be regenerated.
2012-11-25 08:14:23 +01:00
Nikita Popov
f3192ea6e4 Fix 64bit JSON test 2012-08-13 18:43:03 +02:00
Xinchen Hui
f8559194db Fix test failed due to new feature introduced in 45d596ea 2012-07-29 23:35:06 +08:00
Florian Anderiasch
45d596ea1e Add optional depth parameter to json_encode #62369 2012-07-24 13:15:16 +02:00
Nikita Popov
b7903f9778 Revert JSON merges to 5.4
This reverts the following merge commits (-m 1):

405ebfcd18
d372b33c9b
36fa17a5fa
2012-07-01 16:38:26 +02:00
Stanislav Malyshev
b741d3315b fix bug #61359: json_encode() calls too many reallocs 2012-06-30 19:14:30 -07:00
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