Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,22 @@ Revision history for Perl extension Cpanel::JSON::XS

TODO: http://stevehanov.ca/blog/index.php?id=104 compression

4.39 2024-12-12 (rurban)
- Fix Windows -Dusequadmath (sisyphus GH #235, GH #229)
- Fix inconsistent behavior between decoding escaped and unescaped
surrogates, and escaped non-characters vs non-escaped non-characters.
Now aligned to JSON::PP (Gavin Hayes GH #233, GH #227)
- Add type_all_string tests (Bernhard Schmalhofer GH #236)
- Silence UV to char cast warnings (bulk88 GH #232)
- Fix MSVC preprocessor errors (bulk88 GH #232)
- Fix -Wformat warnings on Windows (sisyphus GH #228)
- Clarify BigInt decoding (GH #226)

4.38 2024-05-27 (rurban)
- Encode real core booleans as boolean notation (PR #224 leonerd)
- Minor test fixes by leonerd
- Fix docs typo (PR #225 karenetheridge)

4.37 2023-07-04 (rurban)
- Fix NAN/INF for AIX (Tux: AIX-5.3, tested by XSven on AIX-7.3) GH #165
- Fix empty string result in object stringification (PR #221 jixam)
Expand Down
2 changes: 1 addition & 1 deletion META.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
"url" : "https://github.com/rurban/Cpanel-JSON-XS"
}
},
"version" : "4.37",
"version" : "4.39",
"x_contributors" : [
"Ashley Willis <[email protected]>",
"Chip Salzenberg <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion META.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ resources:
bugtracker: https://github.com/rurban/Cpanel-JSON-XS/issues
license: http://dev.perl.org/licenses/
repository: https://github.com/rurban/Cpanel-JSON-XS
version: '4.37'
version: '4.39'
x_contributors:
- 'Ashley Willis <[email protected]>'
- 'Chip Salzenberg <[email protected]>'
Expand Down
4 changes: 4 additions & 0 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ if ($Config{gccversion} and $Config{gccversion} =~ /^(\d+\.\d+)\./) {
} elsif ($gccver >= 3.4) {
$define = '-Wall -Wdeclaration-after-statement -Wextra -W';
}

# -Wformat does not support the Windows specific "%I64u" format
# and will cause false warnings in compiling 'encode_sv'.
if($define && $^O =~/MSWin32/i) { $define .= ' -Wno-format' }
}
if ($] < 5.022 && $Config{d_setlocale} && $Config{usethreads}) {
if (-e "/usr/include/xlocale.h") {
Expand Down
50 changes: 35 additions & 15 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -280,10 +280,11 @@ A FEW NOTES ON UNICODE AND PERL

5. A string containing "high" (> 255) character values is *not* a UTF-8
string.
6. Unicode noncharacters only warn, as in core.
6. Raw non-Unicode characters below U+10FFFF are allowed.
The 66 Unicode noncharacters U+FDD0..U+FDEF, and U+*FFFE, U+*FFFF
just warn, see <http://www.unicode.org/versions/corrigendum9.html>.
But illegal surrogate pairs fail to parse.
are allowed without warning, as JSON::PP does, see
<http://www.unicode.org/versions/corrigendum9.html>. But illegal
surrogate pairs fail to parse.

7. Raw non-Unicode characters above U+10FFFF are disallowed.
Raw non-Unicode characters outside the valid unicode range fail to
Expand All @@ -292,6 +293,16 @@ A FEW NOTES ON UNICODE AND PERL
Unicode RFC 7159 section 8.1. We use now the UTF8_DISALLOW_SUPER
flag when parsing unicode.

8. Lone surrogates or illegal surrogate pairs are disallowed.
Since RFC 3629, U+D800 through U+DFFF are not legal Unicode values
and their UTF-8 encodings must be treated as an invalid byte
sequence. RFC 8259 section 8.2 admits the spec allows string values
that contain bit sequences that cannot encode Unicode characters and
that the behavior of software that receives such values is
unpredictable. To avoid introducing non-Unicode strings into Perl we
use the UTF8_DISALLOW_SURROGATE flag when parsing Unicode and verify
escaped surrogates form valid pairs.

I hope this helps :)

OBJECT-ORIENTED INTERFACE
Expand Down Expand Up @@ -633,9 +644,10 @@ OBJECT-ORIENTED INTERFACE
$json = $json->unblessed_bool([$enable])

If $enable is true (or missing), then "decode" will return Perl
non-object boolean variables (1 and 0) for JSON booleans ("true" and
"false"). If $enable is false, then "decode" will return
"JSON::PP::Boolean" objects for JSON booleans.
non-object boolean variables (1 and 0 as numbers or "1" and "" as
strings) for JSON booleans ("true" and "false"). If $enable is
false, then "decode" will return "JSON::PP::Boolean" objects for
JSON booleans.

$json = $json->allow_singlequote ([$enable])
$enabled = $json->get_allow_singlequote
Expand Down Expand Up @@ -672,6 +684,10 @@ OBJECT-ORIENTED INTERFACE
integer Perl cannot handle as integer into a Math::BigInt object and
convert a floating number (any) into a Math::BigFloat.

$int = $json->allow_nonref->allow_bignum->decode(1); # => 1
$bigint = $json->allow_bignum->decode('100000000000000000000000000000000000000');
$bigfloat = $json->allow_bignum->decode(1.0);

On the contrary, "encode" converts "Math::BigInt" objects and
"Math::BigFloat" objects into JSON numbers with "allow_blessed"
enable.
Expand Down Expand Up @@ -1066,7 +1082,7 @@ INCREMENTAL PARSING
parentheses. The only thing it guarantees is that it starts decoding as
soon as a syntactically valid JSON text has been seen. This means you
need to set resource limits (e.g. "max_size") to ensure the parser will
stop parsing in the presence if syntax errors.
stop parsing in the presence of syntax errors.

The following methods implement this incremental parser.

Expand Down Expand Up @@ -1797,17 +1813,21 @@ ENCODING/CODESET FLAG NOTES
This works because "__proto__" is not valid outside of strings, so every
occurrence of ""__proto__"\s*:" must be a string used as property name.

Unicode non-characters between U+FFFD and U+10FFFF are decoded either to
the recommended U+FFFD REPLACEMENT CHARACTER (see Unicode PR #121:
Recommended Practice for Replacement Characters), or in the binary or
relaxed mode left as is, keeping the illegal non-characters as before.

Raw non-Unicode characters outside the valid unicode range fail now to
parse, because "A string is a sequence of zero or more Unicode
characters" RFC 7159 section 1 and "JSON text SHALL be encoded in
Unicode RFC 7159 section 8.1. We use now the UTF8_DISALLOW_SUPER flag
when parsing unicode.

Since RFC 3629, U+D800 through U+DFFF are not legal Unicode values and
their UTF-8 encodings must be treated as an invalid byte sequence. RFC
8259 section 8.2 admits the spec allows string values that contain bit
sequences that cannot encode Unicode characters and that the behavior of
software that receives such values is unpredictable. To avoid
introducing non-Unicode strings into Perl we use the
UTF8_DISALLOW_SURROGATE flag when parsing Unicode and verify escaped
surrogates form valid pairs.

If you know of other incompatibilities, please let me know.

JSON and YAML
Expand Down Expand Up @@ -2134,9 +2154,9 @@ LICENSE
SEE ALSO
The cpanel_json_xs command line utility for quick experiments.

JSON, JSON::XS, JSON::MaybeXS, Mojo::JSON, Mojo::JSON::MaybeXS,
JSON::SL, JSON::DWIW, JSON::YAJL, JSON::Any, Test::JSON,
Locale::Wolowitz, <https://metacpan.org/search?q=JSON>
JSON::PP, JSON, JSON::XS, JSON::MaybeXS, Mojo::JSON,
Mojo::JSON::MaybeXS, JSON::SL, JSON::DWIW, JSON::YAJL, JSON::Any,
Test::JSON, Locale::Wolowitz, <https://metacpan.org/search?q=JSON>

<https://tools.ietf.org/html/rfc7159>

Expand Down
51 changes: 27 additions & 24 deletions SIGNATURE
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
signed via the Module::Signature module, version 0.88.
signed via the Module::Signature module, version 0.89.

To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
Expand All @@ -16,25 +16,25 @@ Hash: RIPEMD160

SHA256 aac2b4bbaa7b93eaf72300f60e167a17e05adcd721087f735ba55d2900f31490 .appveyor.yml
SHA256 082201a3cbd62a55f2e58ffbb991c4b2bb806de0009bc9497ffcc07202f60855 .github/FUNDING.yml
SHA256 136c5a00ee7c7425150f18013743e7b0d30339eca0f08901d4cf6b8731a6b017 .github/workflows/testsuite.yml
SHA256 724cc9e03083bc4d51ec2659118a9bb7ca66ca5f640a1d249ae3732d68511380 .github/workflows/testsuite.yml
SHA256 a3c34aba52e269e6cec558ecf9cff393138574189fdff26b183bee9cc2e0434f .travis.yml
SHA256 c3f2a1a4f66382f796f71a571946722edba53cf3238152b26fd325f4c2f1a20f .whitesource
SHA256 8de3540a3cd7ecc9a9dcb48975fe852c082fe17d4462f87bb72aa7cc47f083ad COPYING
SHA256 a0c1df3ac89bec04046fe55c39cd20773a4d6f104e76508ef2c688dfc3db6dfa Changes
SHA256 ee990945735ae8b4b7b264dbd98ac361fa4b5ef59d2893343c53c2b09b3971e1 Changes
SHA256 a5378ebe65273d49047a21e94af087f70a303793ffed2a695c800ed965ac185d MANIFEST
SHA256 ec3a3db51c59096cc14f7712986e3ab2e4027a40f3cc1faf9be69553c172e32c META.json
SHA256 c76fb8cf23082da8da4f9ffff46a25501af0c2769a6dbf9fbeeaf0f32d536b0a META.yml
SHA256 31d74c68c91639bc34e18541091616d226713c6c49168d42eefab58535f5cd4a Makefile.PL
SHA256 2eb1d8124526462c3afb4089a09a36d2e22da1b931a859f1ec06bec81d8a4245 README
SHA256 cf86fbae8a2abeadbd634c40b126f390077dd4a97bd54e2a8ec7311e9e9d71ae XS.pm
SHA256 21e00e79d18a7320df51dbc7a053052602d30659475a95bbbd366cb1d61a3f21 XS.xs
SHA256 445f18f73b799c4a86167412664e567fd0b6aa1d3d61fdf61dc74a1143e5dcd5 META.json
SHA256 be01f9e157d49e4cc37184bcc5e73cbc0befb3b441bc6b1ae647e838427c2e61 META.yml
SHA256 1ad5eab412179cae0dceb6fd9346aa20650988dd6eee23c3482a21d8714dd5bf Makefile.PL
SHA256 c62f5a06dffaa850fe7d55cad1c5ce3fbdb5504031b73b6043aa2974708c9293 README
SHA256 54c8486f5141eae12a12db7bb92d5883605edfd30de355a531ba267ebbdb4e5e XS.pm
SHA256 b71b7e0cadd6dfefb8f593d85de68d4d7b4d36b73e2e75344b79be377d98a61e XS.xs
SHA256 c95e4b970183cbd6d1ec9c88c37a80f12bd2b66ed6be3c008ffd578d2f622c01 XS/Boolean.pm
SHA256 20596259e7e399ed1984a469a9a907be878499406d5285a11f1ab98f93aff44f XS/Type.pm
SHA256 2f34a530b7ce981b0df9aacd2b6944ccf74c4a7f8bb49fde57b342663e7feb26 bin/cpanel_json_xs
SHA256 0d188abe82c2270e7bc5fc21de1d8210bfc52118a834b22592781bb2879a6065 eg/bench
SHA256 3290077eba2e57ff1d2bf46c2a7d34a3b9c7f9b24fe517a3943430f5720da95f ppport.h
SHA256 8bd5ef4d15ed3a9b2e641cc04549d6eed1532c86bba907e2b035d80c8dd5ac2c t/00_load.t
SHA256 07c0d02dcabd1d0996e6ab852df867fe7f91d551579832760262f586b56a1808 t/01_utf8.t
SHA256 0cefac61a4f61481fb66be51997b99b0e6da84f62b4976686d9ef87284ca5378 t/01_utf8.t
SHA256 d2ec342bd9183411689ae9fee51b4e6730f6e5dce95f49cb59b4b38237337f1e t/02_error.t
SHA256 e02e3fc388734af0fb8f7b8c8ebe4163ba4cfe5db94cc46b67776db0774ac716 t/03_types.t
SHA256 36a9a87f4e143077195add1e8d931ff49d7e71f93f66326def22703158c268e1 t/04_dwiw_encode.t
Expand All @@ -51,7 +51,7 @@ SHA256 16f34295a33f59b8fe7a4f70b701df03fc866d77eac300ca0503a98875675569 t/107_al
SHA256 f2047975a3b8392feb6a87d782ecc7746ae2117bde57f716cc90877c8850f2e0 t/108_decode.t
SHA256 e6f7738431bc8d77ad0b8ad2db9ab54426f7bbc86eb5f5794b1a4616f454baef t/109_encode.t
SHA256 d6c467d647ab46c64734d6c6913ff262e854e00073a804da186caf894c5367d0 t/10_pc_keysort.t
SHA256 256e0dcaae188387bc0db211dd3b713576d73c01d95c5429417ed9c622640b4d t/110_bignum.t
SHA256 b83ef117bbbadaa4cdeccf0a0dec6087bd97094980638d982f7f805cf006f988 t/110_bignum.t
SHA256 9c6d125de04ea14d24bbc96aafcbe8fbad75811ce4bf4e4d2d569eee8f195de0 t/112_upgrade.t
SHA256 b207546715e27fe738f448fb0e1087b73bfd2a002c0254f656e6b4d47e154f58 t/113_overloaded_eq.t
SHA256 89a6817b7b7ad584200b65c4b17e0c3960637162308d7bfd6d74756754235cc5 t/114_decode_prefix.t
Expand All @@ -61,7 +61,7 @@ SHA256 cd69ce6908281737a22df45ce40e0cca3080312faa666ef68701c33fefc145c9 t/117_nu
SHA256 34a7fd54a9c17af5bc643bf237d334b9f664c4af9fc699e8af2d6347696ef13e t/118_type.t
SHA256 5f4f0f1d4221f5b5c28c1988f4d127462a42f36ae82fedd7319c8e0fbfbd57eb t/119_type_decode.t
SHA256 8f0f898f0499424740eea5e2537e97faee949b1e3981a1588b1a61645d942d3c t/11_pc_expo.t
SHA256 67295534f9f44b6c2fd9375a4baff3b959318ce2468d466204efd1aeb8caadae t/120_type_all_string.t
SHA256 5b27401bd1e20eeabdff15e9453d67806bba74ccd6a9f4d1d934a25e8126e0f3 t/120_type_all_string.t
SHA256 af3adbcc14e32df9fc2ef3f9a1502c1335a9e2da36ac54119be1f98fcabb4264 t/121_memleak.t
SHA256 782bc33e7b6e46d42a168713b0828db134c7885f67fdd35ac53619ba6476aef6 t/125_shared_boolean.t
SHA256 a1249dee56939f6577f385b1b5942f57009f1b5bd1d785616bc62802146f41ec t/12_blessed.t
Expand All @@ -73,22 +73,22 @@ SHA256 398e5ff51603a52de901f4c1934265601e226d05b88ac604dcd9e9d179a0344f t/17_rel
SHA256 1585a6aecec5c73b7a6f70982b3bcc1edc1d63ca55467223ab0d6f0956254bc4 t/18_json_checker.t
SHA256 9f9006c1f925d9ace7d1621e1479c21f9b50459ab57aa0046209fed2b3e66530 t/19_incr.t
SHA256 dde73ed3cfc0e28d064f61fc08871accf88b780aee06a3cb0040f59f04c1ff36 t/20_faihu.t
SHA256 fcac4365f8d9ba099ea90b6442eb205433d8419ffda5be82d66f5d69c3cdefe3 t/20_unknown.t
SHA256 56e11977ce3d544f8c8e62a38cbcc4f58f7f1d53b71918f803536acd62122713 t/20_unknown.t
SHA256 388f8e0f0e41c9921aedc67313f8b89bdd08b95ced0dba242986d3b76d9a1688 t/21_evans.t
SHA256 3da823eab55abb6dca05e8bc6111d3b59ea18c4ee270baf6413d9a45042ff48c t/22_comment_at_eof.t
SHA256 2a6506fb07b27b1fef52b251d3876d23bd572596ff487d37c2f6597be554836c t/23_array_ctx.t
SHA256 a8dfccba0b60b0fc91812fcfd96656e993abb74970509926d738c67a58641f01 t/24_freeze_recursion.t
SHA256 3d81e94b5d3407ba3df47ccace0aaf8f16bad9da3016e74f653e150629ce5b36 t/25_boolean.t
SHA256 d6e46428bf221ea9bca6f8c0a9d14ee76305d91e01d9946b570aac125d392ba8 t/25_boolean.t
SHA256 e7297f97fe3fea65c865658675b72e667b37b201e7fec8b8128f2006f8999d86 t/26_duplicate.t
SHA256 03a2061b4742ea591961a4ce7403feac91998c0909dbde982c465ce3d2c39706 t/30_jsonspec.t
SHA256 814438975ce229d4ff0deb6a9aef967b7f088e03894b8b8e6ca1ccfb6d953117 t/30_jsonspec.t
SHA256 cf2181a691d5e1862d71e4e902928a0d899b9671e3633584efa8ae3f5cc0d174 t/31_bom.t
SHA256 59c743137453c8c4e9e785a15dcd057b0209d5ce160d683d7ab416dc37a92b6d t/52_object.t
SHA256 3b9ce402e2d0cae8a525df4beca05f2656ba5cf02b074d02fd690fe97773d2d7 t/53_readonly.t
SHA256 a08be137b59c9cd58410bc41969e1e9e9fa2159469523394b6bfd0c798c00908 t/54_stringify.t
SHA256 f542b8cfd2bee5ab9ae92dd042e3bbf68a968ae959d0eeada43cd5cd53c8337a t/55_modifiable.t
SHA256 7e825a17dc348ddee2b61e686a670115c31d80f372a7614e27811b9f3d795c79 t/96_interop.t
SHA256 f720857c5fb03c62aab4765610ab05326e5139505f823400605abaebedffeb32 t/96_interop_pp.t
SHA256 ddf64cc8fddcf0d2b32c34b2969730a955869edf51b4157a3d3591334dd6b8de t/96_mojo.t
SHA256 40683e1922b62e46053ee60bf4c94e2ca9dbbe0da9d3131c16b4ef49045feb0a t/96_mojo.t
SHA256 f847d17e014f19232281a3f44184da5f6dc0d1efb2d817d03156d1ff3d152afa t/97_unshare_hek.t
SHA256 6b6c59c5f260f28afca3ccfe0785fb8da328ee3aa259079ef5dd982822862726 t/98_56only.t
SHA256 fc880ee039642bcb1517cdb4afaa8060471785b521df45d295b50041137211e5 t/99_binary.t
Expand Down Expand Up @@ -446,12 +446,15 @@ SHA256 5a4c8ec0943d40da2d65d3e4325ba55168f0f4a243dad391431df3d89d73e3d3 xt/pod-s
SHA256 aca6f846869ab2e4881e807739086e1535b1438bd0e23d7a021360742736a6a9 xt/pod.t
-----BEGIN PGP SIGNATURE-----

iQEzBAEBAwAdFiEEKJWogdNCcPq/6PdHtPYzOeZdZBQFAmSj9eoACgkQtPYzOeZd
ZBTP2wf8DlABhDoQ9mJCIILTVANIlJzE4HcTDwVczvLVSo9q7nBkuRC0HQoh8tfg
vl6zPgFLNEpjES2kYUQsjNxdrOJ06lB1n2Bm5G3BrSxCHg5oEQ5RPukDcTbWF1Mx
6uZvtUWCoP5lsUdJ5QqM4fhNDf9iXkY+14EZGMwPj2ia07gkbo7vf2v6vpSIvmze
dKRP7finLl+mPpBTXZtJ6REva/Ip5BFfxKdCpbVqOSmcCJ3bBkw1MT4UDalhmr9n
3bOliBpZa2Wx12jWk6Iewqw68p+jCjT6dNmA1Q3Ct+ii9ihYkVuCV6vGY1WCHpCl
C4xy/13TfjfQ5ZjfhVOeXF8OAHiIrA==
=bfLU
iQGzBAEBAwAdFiEEOKQWew22nknF9yFsuMKIZqsnp6IFAmdbUkEACgkQuMKIZqsn
p6J51Av/YTs0fXeOQoB8pgohlUf8bZAmOAguteMvxaI+rrkDjVbHLIR53fC/TXEF
OCPQqrqFO6aayuUlU3R1rK8LnGjtwBtdo47C548gxIsORITTM8+iQRjt5bnOfpV8
pSHdY9x6HxYWdvEEWa3zOxqr6KOy4yZWtf2Jnki1VUMrsriD9rxJ9nGlA1quULXX
GMILyv1hkDdMC+wdkbY5YECJfPZo1xvRl8uIciFKNKb+Aysl1SJ/PTzP4lgoHTP4
Hxu9B0QG72JXh2ZacpmqnlXfNAIJaA1WrmiQf+mPrriC8xyu9s/wsaLcoc1ndvqH
sWXiRyjfEw+0+B8VeIK/NEeJ9dnLRpWx0/IBvtnjQS3afnlflooaf8pB7D6SHBY4
nS4vipjB3UUw+vA4wO3up9WHDuG7WlucO7k9nqSHcZSorCub7z2mB/TL5Dd88h/s
2X0wBnuqgVjY8UYvnbr4BeSVRdhMwSNsJbyQ3J5XVDAj86N7P9o0xYLYuTlVS1fK
rfVlKCoA
=Rrxl
-----END PGP SIGNATURE-----
Loading
Loading