Hello community,
here is the log from the commit of package perl-Cpanel-JSON-XS for
openSUSE:Factory checked in at 2020-08-17 12:06:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS (Old)
and /work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new.3399 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Cpanel-JSON-XS"
Mon Aug 17 12:06:22 2020 rev:27 rq:827142 version:4.21
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS/perl-Cpanel-JSON-XS.changes
2020-02-13 10:11:13.076329618 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new.3399/perl-Cpanel-JSON-XS.changes
2020-08-17 12:07:09.542753737 +0200
@@ -1,0 +2,23 @@
+Fri Aug 14 03:07:29 UTC 2020 - Tina Müller <[email protected]>
+
+- updated to 4.21
+ see /usr/share/doc/packages/perl-Cpanel-JSON-XS/Changes
+
+ 4.21 2020-08-13 (rurban)
+ - Fix not enough HEK memory allocation for the new canonical tied
hashes
+ feature. (GH #168)
+ - TODO broken JSON::PP::Boolean versions 2.9x - 4.0 with
threads::shared in
+ 125_shared_boolean.t
+
+ 4.20 2020-08-12 (rurban)
+ - New feature: sort tied hashes with canonical. (GH #167)
+ - Fix encode of threads::shared boolean (#166 Sam Bingner).
+ This was broken with 4.00.
+ - Fix some stringify overload cases via convert_blessed (GH #105)
+ - Fix a compat case with JSON::XS, when convert_blessed is set, but
+ allow_blessed not. (GH #105)
+ - Improve blessed and stringify tests
+ - Work on better inf/nan detection on AIX (#165 Peter Heuchert)
+ - Fix documentation for booleans and their types (#162 by Karen
Etheridge)
+
+-------------------------------------------------------------------
Old:
----
Cpanel-JSON-XS-4.19.tar.gz
New:
----
Cpanel-JSON-XS-4.21.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Cpanel-JSON-XS.spec ++++++
--- /var/tmp/diff_new_pack.BWrXPW/_old 2020-08-17 12:07:11.274754702 +0200
+++ /var/tmp/diff_new_pack.BWrXPW/_new 2020-08-17 12:07:11.278754704 +0200
@@ -1,7 +1,7 @@
#
# spec file for package perl-Cpanel-JSON-XS
#
-# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany.
+# Copyright (c) 2020 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -17,13 +17,13 @@
Name: perl-Cpanel-JSON-XS
-Version: 4.19
+Version: 4.21
Release: 0
%define cpan_name Cpanel-JSON-XS
Summary: CPanel fork of JSON::XS, fast and correct serializing
License: Artistic-1.0 OR GPL-1.0-or-later
Group: Development/Libraries/Perl
-Url: https://metacpan.org/release/%{cpan_name}
+URL: https://metacpan.org/release/%{cpan_name}
Source0:
https://cpan.metacpan.org/authors/id/R/RU/RURBAN/%{cpan_name}-%{version}.tar.gz
Source1: cpanspec.yml
BuildRoot: %{_tmppath}/%{name}-%{version}-build
++++++ Cpanel-JSON-XS-4.19.tar.gz -> Cpanel-JSON-XS-4.21.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/Changes
new/Cpanel-JSON-XS-4.21/Changes
--- old/Cpanel-JSON-XS-4.19/Changes 2020-02-06 16:04:01.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/Changes 2020-08-13 08:54:35.000000000 +0200
@@ -2,6 +2,23 @@
TODO: http://stevehanov.ca/blog/index.php?id=104 compression
+4.21 2020-08-13 (rurban)
+ - Fix not enough HEK memory allocation for the new canonical tied
hashes
+ feature. (GH #168)
+ - TODO broken JSON::PP::Boolean versions 2.9x - 4.0 with
threads::shared in
+ 125_shared_boolean.t
+
+4.20 2020-08-12 (rurban)
+ - New feature: sort tied hashes with canonical. (GH #167)
+ - Fix encode of threads::shared boolean (#166 Sam Bingner).
+ This was broken with 4.00.
+ - Fix some stringify overload cases via convert_blessed (GH #105)
+ - Fix a compat case with JSON::XS, when convert_blessed is set, but
+ allow_blessed not. (GH #105)
+ - Improve blessed and stringify tests
+ - Work on better inf/nan detection on AIX (#165 Peter Heuchert)
+ - Fix documentation for booleans and their types (#162 by Karen
Etheridge)
+
4.19 2020-02-06 (rurban)
- Fix typed decode memory leak (#160 by Pali).
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/MANIFEST
new/Cpanel-JSON-XS-4.21/MANIFEST
--- old/Cpanel-JSON-XS-4.19/MANIFEST 2020-02-06 16:07:16.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/MANIFEST 2020-08-13 08:55:16.000000000 +0200
@@ -44,6 +44,7 @@
t/11_pc_expo.t
t/120_type_all_string.t
t/121_memleak.t
+t/125_shared_boolean.t
t/12_blessed.t
t/13_limit.t
t/14_latin1.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/META.json
new/Cpanel-JSON-XS-4.21/META.json
--- old/Cpanel-JSON-XS-4.19/META.json 2020-02-06 16:07:15.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/META.json 2020-08-13 08:55:16.000000000 +0200
@@ -4,7 +4,7 @@
"Reini Urban <[email protected]>"
],
"dynamic_config" : 0,
- "generated_by" : "ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter
version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 8.3508, CPAN::Meta::Converter
version 2.150010",
"license" : [
"perl_5"
],
@@ -100,7 +100,7 @@
"url" : "https://github.com/rurban/Cpanel-JSON-XS"
}
},
- "version" : "4.19",
+ "version" : "4.21",
"x_contributors" : [
"Ashley Willis <[email protected]>",
"Chip Salzenberg <[email protected]>",
@@ -127,5 +127,5 @@
"Syohei Yoshida <[email protected]>",
"tevfik1903 <[email protected]>"
],
- "x_serialization_backend" : "JSON::PP version 2.97001"
+ "x_serialization_backend" : "JSON::PP version 4.04_01"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/META.yml
new/Cpanel-JSON-XS-4.21/META.yml
--- old/Cpanel-JSON-XS-4.19/META.yml 2020-02-06 16:07:15.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/META.yml 2020-08-13 08:55:16.000000000 +0200
@@ -22,7 +22,7 @@
Config: '0'
ExtUtils::MakeMaker: '0'
dynamic_config: 0
-generated_by: 'ExtUtils::MakeMaker version 7.38, CPAN::Meta::Converter version
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 8.3508, CPAN::Meta::Converter
version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -48,7 +48,7 @@
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.19'
+version: '4.21'
x_contributors:
- 'Ashley Willis <[email protected]>'
- 'Chip Salzenberg <[email protected]>'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/README
new/Cpanel-JSON-XS-4.21/README
--- old/Cpanel-JSON-XS-4.19/README 2020-02-06 16:07:16.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/README 2020-08-13 08:55:17.000000000 +0200
@@ -161,10 +161,12 @@
- #72 parsing of illegal unicode or non-unicode characters.
- - #96 locale-insensitive numeric conversion
+ - #96 locale-insensitive numeric conversion.
- #154 numeric conversion fixed since 5.22, using the same strtold as
perl5.
+ - #167 sort tied hashes with canonical.
+
- public maintenance and bugtracker
- use ppport.h, sanify XS.xs comment styles, harness C coding style
@@ -225,10 +227,10 @@
For the type argument see Cpanel::JSON::XS::Type.
$is_boolean = Cpanel::JSON::XS::is_bool $scalar
- Returns true if the passed scalar represents either "JSON::XS::true"
- or "JSON::XS::false", two constants that act like 1 and 0,
+ Returns true if the passed scalar represents either "JSON::PP::true"
+ or "JSON::PP::false", two constants that act like 1 and 0,
respectively and are used to represent JSON "true" and "false"
- values in Perl.
+ values in Perl. (Also recognizes the booleans produced by JSON::XS.)
See MAPPING, below, for more information on how JSON values are
mapped to Perl.
@@ -587,7 +589,11 @@
This setting has no effect when decoding JSON texts.
- This setting has currently no effect on tied hashes.
+ This is now also done with tied hashes, contrary to JSON::XS. But
+ note that with most large tied hashes stored as tree it is advised
+ to sort the iterator already and don't sort the hash output here.
+ Most such iterators are already sorted, as such e.g. DB_File with
+ "DB_BTREE".
$json = $json->sort_by (undef, 0, 1 or a block)
This currently only (un)sets the "canonical" option, and ignores
@@ -615,7 +621,7 @@
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
- "Cpanel::JSON::XS::Boolean" objects for JSON booleans.
+ "JSON::PP::Boolean" objects for JSON booleans.
$json = $json->allow_singlequote ([$enable])
$enabled = $json->get_allow_singlequote
@@ -762,7 +768,8 @@
"TO_JSON" method found) is being encoded. Has no effect on "decode".
If $enable is false (the default), then "encode" will throw an
- exception when it encounters a blessed object.
+ exception when it encounters a blessed object without
+ "convert_blessed" and a "TO_JSON" method.
This setting has no effect on "decode".
@@ -1325,11 +1332,11 @@
When "unblessed_bool" is set to true, then JSON "true" becomes 1 and
JSON "false" becomes 0.
- Otherwise these JSON atoms become "Cpanel::JSON::XS::true" and
- "Cpanel::JSON::XS::false", respectively. They are
- "JSON::PP::Boolean" objects and are overloaded to act almost exactly
- like the numbers 1 and 0. You can check whether a scalar is a JSON
- boolean by using the "Cpanel::JSON::XS::is_bool" function.
+ Otherwise these JSON atoms become "JSON::PP::true" and
+ "JSON::PP::false", respectively. They are "JSON::PP::Boolean"
+ objects and are overloaded to act almost exactly like the numbers 1
+ and 0. You can check whether a scalar is a JSON boolean by using the
+ "Cpanel::JSON::XS::is_bool" function.
The other round, from perl to JSON, "!0" which is represented as
"yes" becomes "true", and "!1" which is represented as "no" becomes
@@ -2068,6 +2075,9 @@
Cpanel::JSON::XS has proper ithreads support, unlike JSON::XS. If you
encounter any bugs with thread support please report them.
+ From Version 4.00 - 4.19 you couldn't encode true with threads::shared
+ magic.
+
BUGS
While the goal of the Cpanel::JSON::XS module is to be correct, that
unfortunately does not mean it's bug-free, only that the author thinks
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/SIGNATURE
new/Cpanel-JSON-XS-4.21/SIGNATURE
--- old/Cpanel-JSON-XS-4.19/SIGNATURE 2020-02-06 16:07:16.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/SIGNATURE 2020-08-13 08:55:17.000000000 +0200
@@ -1,5 +1,5 @@
This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.83.
+signed via the Module::Signature module, version 0.87.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
@@ -12,21 +12,21 @@
not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA256
+Hash: RIPEMD160
SHA256 aac2b4bbaa7b93eaf72300f60e167a17e05adcd721087f735ba55d2900f31490
.appveyor.yml
SHA256 082201a3cbd62a55f2e58ffbb991c4b2bb806de0009bc9497ffcc07202f60855
.github/FUNDING.yml
SHA256 fb7ff638c0af0c5dde7148f2b00836ca1afd14fdde99f874922b98b08725af36
.travis.yml
SHA256 c3f2a1a4f66382f796f71a571946722edba53cf3238152b26fd325f4c2f1a20f
.whitesource
SHA256 8de3540a3cd7ecc9a9dcb48975fe852c082fe17d4462f87bb72aa7cc47f083ad COPYING
-SHA256 5f61536a05c07c011ff3491c4dd37bc29dc9e0daafeea63d88efc1b511e48659 Changes
-SHA256 93c01edfcdc61846f6d525c3c463edb70c37640b19efd3560920aff9a6f0cf54
MANIFEST
-SHA256 81a8cae7d45b16996ee5e8b17eea1fb5ee09005bc8151568362e0cc5ad8e3e85
META.json
-SHA256 0223313bb42d022919df2d7864c05d48fcf45cf2518b1e698ef8552c3a32bab0
META.yml
+SHA256 7f44a269deb1bc611e6eceddb4a21201cc1625bb360f9d4201c77e02071d0b66 Changes
+SHA256 9a862bfa951e3d5b43c2dcb95767dbf15ed2ee3af872442d3815795757533f29
MANIFEST
+SHA256 672461b0b6067e671c2e434c4bf0d448f3f95b81b26c05d3a82343ab43382366
META.json
+SHA256 2e16dbc4f7de035f685a9bfded970157636f88e036c75f3bb1cd8f924f900688
META.yml
SHA256 e4e901f402d07d3ca2b4a8ce90b1912980072367bf61faa95874e4e3b38cdc32
Makefile.PL
-SHA256 e2bbfc6c67915abca519b1e2172384f6229e8c4c8e08c140ad4533a349850d1b README
-SHA256 09a00f40c0721ea88e1972fb5a1619f39ce8ad20216b4b2873594db19fc7865c XS.pm
-SHA256 6982a29643663d2eb2c33fdea42c85c2a4351ccf0beea7dfddc36448e47390c5 XS.xs
+SHA256 74fe9f05007d22e78f8dae1e9ef9fc62a7be2c971e48109969e2a22951d981cc README
+SHA256 f3a35f686d8f8cda6164a20c110687f1d12b6e663df4ab9c77d869f934f20233 XS.pm
+SHA256 3496d84067a61383ac5ddb69e5ed90dbedbb7c54a1cca2a92fc759853289db4d XS.xs
SHA256 c95e4b970183cbd6d1ec9c88c37a80f12bd2b66ed6be3c008ffd578d2f622c01
XS/Boolean.pm
SHA256 20596259e7e399ed1984a469a9a907be878499406d5285a11f1ab98f93aff44f
XS/Type.pm
SHA256 2f34a530b7ce981b0df9aacd2b6944ccf74c4a7f8bb49fde57b342663e7feb26
bin/cpanel_json_xs
@@ -62,11 +62,12 @@
SHA256 8f0f898f0499424740eea5e2537e97faee949b1e3981a1588b1a61645d942d3c
t/11_pc_expo.t
SHA256 67295534f9f44b6c2fd9375a4baff3b959318ce2468d466204efd1aeb8caadae
t/120_type_all_string.t
SHA256 af3adbcc14e32df9fc2ef3f9a1502c1335a9e2da36ac54119be1f98fcabb4264
t/121_memleak.t
-SHA256 9807d307292461a749f5e1fe4b3b1469e743ea2413e6e6c19208304ca5926f69
t/12_blessed.t
+SHA256 2b0cb6ee1345deedd96ca39331c1ae5ec79410be39a8200035f258eb78680d1e
t/125_shared_boolean.t
+SHA256 b7a68af68d323e6878604ab4df7e4520f188ea3f2d7ff66ae7a3da7c4e86bc68
t/12_blessed.t
SHA256 43a8dfc79182d0ea1462e9266bad1197bc172a9698c0fd002a8e9b0324112ca7
t/13_limit.t
SHA256 99275341c61a98875e26651c858941a299bf6a6fb99a2d60e04d22395b69e3fb
t/14_latin1.t
SHA256 7fb98299aabdc98c4e83404d8fb663d357f815d8dc524406c79b1fd1827531e4
t/15_prefix.t
-SHA256 5652b89a3a7545b92669c55949221cb5b8d5a5a9cbe47e32db3996f5a800da87
t/16_tied.t
+SHA256 4f73fcceb31cfb06ac5110ec89107cc14302905061d28b0700d4673f654d5592
t/16_tied.t
SHA256 a5afaae43c7a21c80f17020b7bfd2d164777499bb940f2482f9167d9a0cf9b54
t/17_relaxed.t
SHA256 1585a6aecec5c73b7a6f70982b3bcc1edc1d63ca55467223ab0d6f0956254bc4
t/18_json_checker.t
SHA256 9f9006c1f925d9ace7d1621e1479c21f9b50459ab57aa0046209fed2b3e66530
t/19_incr.t
@@ -82,7 +83,7 @@
SHA256 cf2181a691d5e1862d71e4e902928a0d899b9671e3633584efa8ae3f5cc0d174
t/31_bom.t
SHA256 59c743137453c8c4e9e785a15dcd057b0209d5ce160d683d7ab416dc37a92b6d
t/52_object.t
SHA256 3b9ce402e2d0cae8a525df4beca05f2656ba5cf02b074d02fd690fe97773d2d7
t/53_readonly.t
-SHA256 949e22de3e54ca7624cea2610a26c0b4697040ea5113fdca3b77564d90f82e24
t/54_stringify.t
+SHA256 66711093766f20d6f8cb3102fa72c74bc63787a852028e53ed33c974c0620879
t/54_stringify.t
SHA256 f542b8cfd2bee5ab9ae92dd042e3bbf68a968ae959d0eeada43cd5cd53c8337a
t/55_modifiable.t
SHA256 4b9df64d243621ccf44f7abb04067a0a0f268105382e92797089106fa77c84a6
t/96_interop.t
SHA256 f720857c5fb03c62aab4765610ab05326e5139505f823400605abaebedffeb32
t/96_interop_pp.t
@@ -433,7 +434,7 @@
SHA256 77b5bd227562c24336c1979a521c0b5721c06b012cf7e7fb21610208f0520357
xt/changes.t
SHA256 c32dc76195cae85cc51b2ee14d6999e2a1fd791162fcd3b0495e1ccdf1ecfd69
xt/checkchanges.t
SHA256 250be3b1b5ce2836369eaf375e9b2b2ad47516bcc1d01b77d79d31b7479007a0
xt/gh70-asan.t
-SHA256 eb0b56e3aef114ff2da8547597f5e94228341891a2f82475d9568f9468a540c7
xt/kwalitee.t
+SHA256 08e9482b1c2e030e1e2d0ee97fef5b70b76a4faf2be1178d22bed123a70c738c
xt/kwalitee.t
SHA256 6b0825520e8a66e1be3f320beffffce7a14e2c49f61af61fe24d9807cb41fcee
xt/leaktrace.t
SHA256 f091e0f6946cfa8b7985d6ccda50d5050a8d1b42844019b3491c5df365227142
xt/manifest.t
SHA256 e6f32877ebc12cedb7756d3de7a7f715ffe2736be060fd49344565d2af0dfbbf
xt/meta.t
@@ -444,12 +445,12 @@
SHA256 aca6f846869ab2e4881e807739086e1535b1438bd0e23d7a021360742736a6a9
xt/pod.t
-----BEGIN PGP SIGNATURE-----
-iQEzBAEBCAAdFiEEKJWogdNCcPq/6PdHtPYzOeZdZBQFAl48K6QACgkQtPYzOeZd
-ZBQtnQgAkxQZ9Ap1lfUlYhD8ftxozV4FhH7cQH4EgeAJFXHVC7nbrgThLEpz4kEc
-+8IiFKXP2sAil0CyndP6WFoUzUXPxZmkHCkBvDv9eSBdnr9g4lPCjzSsdZhQfj4X
-s8WlOtsvI/CzKLic50mf9dtQRZuxpoaQUrEteuh9hHrXwLoFYiO/E0j/Q1NEsMxC
-AWg9+e/VjTmqazl1Gw9LF7SPWhyvqT4f6zMxGDwrmZHRyaJckvC9mV3k10BRT3+t
-BapdsFUdjZQwzXpypnjPjhs+g/h43y9BkASzCH2ik4K/Mp7GIDdNZcPlVCc1D8lp
-uOApb+PZGS5M8Crr7Z/7PBqiBO6ZSg==
-=IUIv
+iQEzBAEBAwAdFiEEKJWogdNCcPq/6PdHtPYzOeZdZBQFAl8049QACgkQtPYzOeZd
+ZBT+SQf/Q9uW0ynIfJrJKysW5v+9FcelNZJfPG0pydca4wEv2LiplTus1zypq4Fq
+luC/7jPDRbVOTljPdPS6f8RmUqTbtwsrm4WmpfdGZbOx3jepfwSkJIV3n50YQupd
+/n9MKC2wONQqGFSWOIZC5jt1M71Muy/HBE3xVvbZGUdjgJ7VP7uD3O7dq9wYhBaf
+L+TQyH/zZlf8N7AspmWg84A+aiacdhBzWURXrrtIn0soK/w9qGMTpT+RJGpPWE/E
+KtEIVH7SDqG1y2mMtX8gndtHHLjSzO3ffawost6fMOkx5GEleGqpFV52isgDIPCX
+hNL4rQtRDCwOUkngsgKqIdEZ8Fvs/g==
+=+LwK
-----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/XS.pm
new/Cpanel-JSON-XS-4.21/XS.pm
--- old/Cpanel-JSON-XS-4.19/XS.pm 2020-02-06 16:04:11.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/XS.pm 2020-08-13 08:54:35.000000000 +0200
@@ -1,5 +1,5 @@
package Cpanel::JSON::XS;
-our $VERSION = '4.19';
+our $VERSION = '4.21';
our $XS_VERSION = $VERSION;
# $VERSION = eval $VERSION;
@@ -174,10 +174,12 @@
- #72 parsing of illegal unicode or non-unicode characters.
- - #96 locale-insensitive numeric conversion
+ - #96 locale-insensitive numeric conversion.
- #154 numeric conversion fixed since 5.22, using the same strtold as perl5.
+ - #167 sort tied hashes with canonical.
+
- public maintenance and bugtracker
- use ppport.h, sanify XS.xs comment styles, harness C coding style
@@ -274,10 +276,10 @@
=item $is_boolean = Cpanel::JSON::XS::is_bool $scalar
-Returns true if the passed scalar represents either C<JSON::XS::true>
-or C<JSON::XS::false>, two constants that act like C<1> and C<0>,
+Returns true if the passed scalar represents either C<JSON::PP::true>
+or C<JSON::PP::false>, two constants that act like C<1> and C<0>,
respectively and are used to represent JSON C<true> and C<false>
-values in Perl.
+values in Perl. (Also recognizes the booleans produced by L<JSON::XS>.)
See MAPPING, below, for more information on how JSON values are mapped
to Perl.
@@ -682,8 +684,10 @@
This setting has no effect when decoding JSON texts.
-This setting has currently no effect on tied hashes.
-
+This is now also done with tied hashes, contrary to L<JSON::XS>.
+But note that with most large tied hashes stored as tree it is advised to
+sort the iterator already and don't sort the hash output here. Most such
+iterators are already sorted, as such e.g. L<DB_File> with C<DB_BTREE>.
=item $json = $json->sort_by (undef, 0, 1 or a block)
@@ -718,7 +722,7 @@
If C<$enable> is true (or missing), then C<decode> will return
Perl non-object boolean variables (1 and 0) for JSON booleans
(C<true> and C<false>). If C<$enable> is false, then C<decode>
-will return C<Cpanel::JSON::XS::Boolean> objects for JSON booleans.
+will return C<JSON::PP::Boolean> objects for JSON booleans.
=item $json = $json->allow_singlequote ([$enable])
@@ -889,7 +893,8 @@
encoded. Has no effect on C<decode>.
If C<$enable> is false (the default), then C<encode> will throw an
-exception when it encounters a blessed object.
+exception when it encounters a blessed object without C<convert_blessed>
+and a C<TO_JSON> method.
This setting has no effect on C<decode>.
@@ -1485,8 +1490,8 @@
When C<unblessed_bool> is set to true, then JSON C<true> becomes C<1> and
JSON C<false> becomes C<0>.
-Otherwise these JSON atoms become C<Cpanel::JSON::XS::true> and
-C<Cpanel::JSON::XS::false>, respectively. They are C<JSON::PP::Boolean>
+Otherwise these JSON atoms become C<JSON::PP::true> and
+C<JSON::PP::false>, respectively. They are C<JSON::PP::Boolean>
objects and are overloaded to act almost exactly like the numbers C<1>
and C<0>. You can check whether a scalar is a JSON boolean by using
the C<Cpanel::JSON::XS::is_bool> function.
@@ -2270,6 +2275,9 @@
Cpanel::JSON::XS has proper ithreads support, unlike JSON::XS. If you
encounter any bugs with thread support please report them.
+From Version 4.00 - 4.19 you couldn't encode true with threads::shared
+magic.
+
=head1 BUGS
While the goal of the Cpanel::JSON::XS module is to be correct, that
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/XS.xs
new/Cpanel-JSON-XS-4.21/XS.xs
--- old/Cpanel-JSON-XS-4.19/XS.xs 2020-01-24 19:52:19.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/XS.xs 2020-08-13 08:54:35.000000000 +0200
@@ -80,6 +80,15 @@
#define HAVE_NEG_NAN
#define STR_NEG_INF "---"
#define STR_NEG_NAN "?"
+#elif defined(_AIX)
+/* xlC compiler: __TOS_AIX__ FIXME: This does not work yet. GH #165 */
+#define STR_INF "INF.0"
+#define STR_INF2 "-INF.0"
+#define HAVE_NEG_NAN
+#define HAVE_QNAN
+#define STR_NAN "NaN"
+//#define STR_QNAN "NaNQ"
+#define STR_QNAN "NANQ"
#else
#define STR_INF "inf"
#define STR_NAN "nan"
@@ -151,12 +160,6 @@
}
#endif
-#if defined(_AIX)
-#define HAVE_QNAN
-#undef STR_QNAN
-#define STR_QNAN "NANQ"
-#endif
-
/* some old perls do not have this, try to make it work, no */
/* guarantees, though. if it breaks, you get to keep the pieces. */
#ifndef UTF8_MAXBYTES
@@ -200,7 +203,17 @@
# define assert_not_ROK(sv)
# endif
#endif
+/* 5.8 problem, it was renamed to HINT_BYTES with 5.8.0 */
+#if PERL_VERSION < 7
+ #ifndef HINT_BYTES
+ #define HINT_BYTES 8
+ #endif
+#endif
/* compatibility with perl <5.14 */
+/* added with 5.13.6 */
+#ifndef sv_cmp_flags
+# define sv_cmp_flags(a,b,flags) sv_cmp((a),(b))
+#endif
#ifndef SvTRUE_nomg
#define SvTRUE_nomg SvTRUE
#endif
@@ -1202,7 +1215,7 @@
return cmp;
}
-/* compare hash entries, used when some keys are sv's or utf-x */
+/* compare hash entries, used when some keys are SV's or UTF-8 */
static int
he_cmp_slow (const void *a, const void *b)
{
@@ -1210,6 +1223,15 @@
return sv_cmp (HeSVKEY_force (*(HE **)b), HeSVKEY_force (*(HE **)a));
}
+/* compare tied hash entries, guaranteed SV's */
+static int
+he_cmp_tied (const void *a, const void *b)
+{
+ dTHX;
+ /* skip GMAGIC */
+ return sv_cmp_flags (HeKEY_sv (*(HE **)b), HeKEY_sv (*(HE **)a), 0);
+}
+
static void
encode_hv (pTHX_ enc_t *enc, HV *hv, SV *typesv)
{
@@ -1272,30 +1294,35 @@
encode_ch (aTHX_ enc, '{');
/* for canonical output we have to sort by keys first */
- /* caused by randomised hash orderings */
- if (enc->json.flags & F_CANONICAL && !SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
+ /* caused by randomised hash orderings or unknown tied behaviour. */
+ if (enc->json.flags & F_CANONICAL)
{
RITER_T i, count = hv_iterinit (hv);
+ HE *hes_stack [STACK_HES];
+ HE **hes = hes_stack;
+ int is_tied = 0;
if (SvMAGICAL (hv))
{
+ if (SvTIED_mg((SV*)hv, PERL_MAGIC_tied))
+ is_tied = 1;
+ /* really should be calling magic_scalarpack(hv, mg) here, but I
doubt it will be correct */
+ /* TODO For tied hashes we should check if the iterator is already
canonical (same sort order)
+ as it would be with a DB tree e.g. and skip our slow sorting. */
+
/* need to count by iterating. could improve by dynamically building
the vector below */
/* but I don't care for the speed of this special case. */
- /* note also that we will run into undefined behaviour when the two
iterations */
- /* do not result in the same count, something I might care for in
some later release. */
-
count = 0;
while (hv_iternext (hv))
++count;
- hv_iterinit (hv);
+ (void)hv_iterinit (hv);
}
- if (count)
+ /* one key does not need to be sorted */
+ if (count > 0)
{
- int fast = 1;
- HE *hes_stack [STACK_HES];
- HE **hes = hes_stack;
+ int has_utf8 = 0;
/* allocate larger arrays on the heap */
if (count > STACK_HES)
@@ -1305,33 +1332,70 @@
}
i = 0;
+ /* fill the HE vector and check if SVKEY or UTF8 */
while ((he = hv_iternext (hv)))
{
- hes [i++] = he;
- if (HeKLEN (he) < 0 || HeKUTF8 (he))
- fast = 0;
+ if (UNLIKELY(is_tied))
+ { // tied entries are completely freed in the next iteration
+ HE *he1;
+ Newz(0,he1,1,HE);
+ he1->hent_hek = safecalloc (1, sizeof (struct hek) + sizeof
(SV*) + 2);
+ HeVAL(he1) = hv_iterval(hv, he);
+ HeSVKEY_set (he1, hv_iterkeysv(he));
+ hes[i++] = he1;
+ }
+ else
+ hes[i++] = he;
+ /* check the SV for UTF8 and seperate use bytes handling */
+ if (!has_utf8)
+ {
+ if (He_IS_SVKEY(he))
+ has_utf8 = SvUTF8(HeSVKEY(he));
+ else
+ has_utf8 = HeKUTF8(he);
+ }
}
+ /* Undefined behaviour when the two iterations do not result in the
same count.
+ With threads::shared or broken tie. The last HEs might be NULL
then or we'll
+ miss some. */
+ if (i != count)
+ croak ("Unstable %shash key counts %d vs %d in subsequent runs",
+ is_tied ? "tied " : "", (int)count, (int)i);
assert (i == count);
- if (fast)
- qsort (hes, count, sizeof (HE *), he_cmp_fast);
- else
+ /* one key does not need to be sorted */
+ if (count > 1)
{
- /* hack to forcefully disable "use bytes" */
- COP cop = *PL_curcop;
- cop.op_private = 0;
- ENTER;
- SAVETMPS;
+ if (!has_utf8)
+ {
+ /* TODO With threads::shared check for qsort_r */
+ qsort (hes, count, sizeof (HE *), is_tied ? he_cmp_tied :
he_cmp_fast);
+ }
+ else
+ {
+ /* hack to forcefully disable "use bytes".
+ Changed in 5.9.4 a98fe34d09e2476f1a21bfb9dc730dc9ab02b0b4
*/
+ COP cop = *PL_curcop;
+#if PERL_VERSION < 10
+ cop.op_private &= ~HINT_BYTES;
+#else
+ cop.cop_hints &= ~HINT_BYTES;
+#endif
+
+ ENTER;
+ SAVETMPS;
- SAVEVPTR (PL_curcop);
- PL_curcop = &cop;
+ SAVEVPTR (PL_curcop);
+ PL_curcop = &cop;
- qsort (hes, count, sizeof (HE *), he_cmp_slow);
+ /* TODO With threads::shared check for qsort_r */
+ qsort (hes, count, sizeof (HE *), is_tied ? he_cmp_tied :
he_cmp_slow);
- FREETMPS;
- LEAVE;
+ FREETMPS;
+ LEAVE;
+ }
}
encode_nl (aTHX_ enc); ++enc->indent;
@@ -1342,7 +1406,7 @@
I32 klen;
encode_indent (aTHX_ enc);
- he = hes [count];
+ he = hes[count];
retrieve_hk (aTHX_ he, &key, &klen);
encode_hk (aTHX_ enc, key, klen);
@@ -1355,10 +1419,18 @@
typesv = *typesv_ref;
}
- encode_sv (aTHX_ enc, UNLIKELY(SvMAGICAL (hv)) ? hv_iterval (hv,
he) : HeVAL (he), typesv);
+ encode_sv(aTHX_ enc,
+ (is_tied || !SvMAGICAL(hv)) ? HeVAL(he)
+ : hv_iterval(hv, he),
+ typesv);
+ if (is_tied)
+ {
+ Safefree (he->hent_hek);
+ Safefree (he);
+ }
if (count)
- encode_comma (aTHX_ enc);
+ encode_comma(aTHX_ enc);
}
encode_nl (aTHX_ enc); --enc->indent; encode_indent (aTHX_ enc);
@@ -1389,12 +1461,15 @@
typesv = *typesv_ref;
}
- encode_sv (aTHX_ enc, UNLIKELY(SvMAGICAL (hv)) ? hv_iterval
(hv, he) : HeVAL (he), typesv);
+ encode_sv(aTHX_ enc,
+ UNLIKELY(SvMAGICAL(hv)) ? hv_iterval(hv, he)
+ : HeVAL(he),
+ typesv);
- if (!(he = hv_iternext (hv)))
- break;
+ if (!(he = hv_iternext(hv)))
+ break;
- encode_comma (aTHX_ enc);
+ encode_comma(aTHX_ enc);
}
encode_nl (aTHX_ enc); --enc->indent; encode_indent (aTHX_ enc);
@@ -1431,11 +1506,20 @@
if (isref && SvAMAGIC(sv))
;
- /* if no string overload found, check allow_stringify */
+ /* if no string overload found, check allow_stringify, allow_unknown
+ and allow_blessed. */
else if (!MyAMG(sv) && !(enc->json.flags & F_ALLOW_STRINGIFY)) {
- if (isref && !(enc->json.flags & F_ALLOW_UNKNOWN))
- croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or
1",
+ if ((isref != 0) && ((enc->json.flags & F_ALLOW_UNKNOWN) == 0)) {
+ croak ("cannot encode reference to scalar '%s' unless the scalar is 0 or
1 "
+ "without allow_unknown",
+ SvPV_nolen (sv_2mortal (newRV_inc (sv))));
+ }
+ else if ((isref == 0) && ((enc->json.flags & F_ALLOW_BLESSED) == 0)) {
+ croak ("encountered %s '%s', but allow_blessed, allow_stringify or "
+ "TO_JSON/FREEZE method missing",
+ SvOBJECT(sv) ? "object" : "reference",
SvPV_nolen (sv_2mortal (newRV_inc (sv))));
+ }
encode_const_str (aTHX_ enc, "null", 4, 0);
return;
}
@@ -1444,7 +1528,11 @@
/* the essential of pp_stringify */
#if PERL_VERSION > 7
pv = newSVpvs("");
- sv_copypv(pv, sv);
+ if (!isref && !(enc->json.flags & F_ALLOW_STRINGIFY)) {
+ sv_copypv(pv, newRV(sv));
+ } else {
+ sv_copypv(pv, sv);
+ }
SvSETMAGIC(pv);
str = SvPVutf8_force(pv, len);
#else
@@ -1551,14 +1639,20 @@
{
if (as_string)
encode_ch (aTHX_ enc, '"');
- if (SvIV_nomg (sv))
+ /* we need to apply threads_shared magic */
+ if
+#ifdef USE_ITHREADS
+ (SvIV (sv))
+#else
+ (SvIV_nomg (sv))
+#endif
encode_const_str (aTHX_ enc, "true", 4, 0);
else
encode_const_str (aTHX_ enc, "false", 5, 0);
if (as_string)
encode_ch (aTHX_ enc, '"');
}
- else if (force_conversion && enc->json.flags & F_CONV_BLESSED)
+ else if (force_conversion && enc->json.flags &
(F_ALLOW_BLESSED|F_CONV_BLESSED))
{
if (as_string)
encode_ch (aTHX_ enc, '"');
@@ -1691,15 +1785,15 @@
else if (svt < SVt_PVAV && svt != SVt_PVGV && svt != SVt_PVHV && svt !=
SVt_PVAV)
{
if (!encode_bool_ref (aTHX_ enc, sv))
- {
- if (enc->json.flags & F_ALLOW_STRINGIFY)
- encode_stringify(aTHX_ enc, sv, SvROK(sv));
- else if (enc->json.flags & F_ALLOW_UNKNOWN)
- encode_const_str (aTHX_ enc, "null", 4, 0);
- else
- croak ("cannot encode reference to scalar '%s' unless the scalar is 0
or 1",
- SvPV_nolen (sv_2mortal (newRV_inc (sv))));
- }
+ {
+ if (enc->json.flags & F_ALLOW_STRINGIFY)
+ encode_stringify(aTHX_ enc, sv, SvROK(sv));
+ else if (enc->json.flags & F_ALLOW_UNKNOWN)
+ encode_const_str (aTHX_ enc, "null", 4, 0);
+ else
+ croak ("cannot encode reference to scalar '%s' unless the scalar
is 0 or 1",
+ SvPV_nolen (sv_2mortal (newRV_inc (sv))));
+ }
}
else if (enc->json.flags & F_ALLOW_UNKNOWN)
encode_const_str (aTHX_ enc, "null", 4, 0);
@@ -1857,7 +1951,7 @@
else if (type == JSON_TYPE_FLOAT)
{
int is_bigobj = 0;
- char *savecur, *saveend;
+ char *savecur = NULL, *saveend = NULL;
char inf_or_nan = 0;
#ifdef NEED_NUMERIC_LOCALE_C
# ifdef HAS_USELOCALE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/t/125_shared_boolean.t
new/Cpanel-JSON-XS-4.21/t/125_shared_boolean.t
--- old/Cpanel-JSON-XS-4.19/t/125_shared_boolean.t 1970-01-01
01:00:00.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/t/125_shared_boolean.t 2020-08-13
08:54:35.000000000 +0200
@@ -0,0 +1,54 @@
+use strict;
+use Config;
+use Test::More;
+use Cpanel::JSON::XS ();
+
+BEGIN {
+ plan skip_all => 'no threads' if !$Config{usethreads};
+ plan tests => 8;
+}
+
+use threads;
+use threads::shared;
+
+my $json1 = shared_clone({'enabled' => Cpanel::JSON::XS::true});
+is( Cpanel::JSON::XS::encode_json( $json1 ), '{"enabled":true}',
"Cpanel::JSON::XS shared true");
+my $json2 = shared_clone({'disabled' => Cpanel::JSON::XS::false});
+is( Cpanel::JSON::XS::encode_json( $json2 ), '{"disabled":false}',
"Cpanel::JSON::XS shared false");
+
+SKIP: {
+ eval "require JSON::XS;";
+ skip "JSON::XS required for testing interop", 4 if $@;
+
+ my $json3 = shared_clone({'enabled' => JSON::XS::true()});
+ is( JSON::XS::encode_json( $json3 ), '{"enabled":true}', "JSON::XS shared
true");
+ my $json4 = shared_clone({'disabled' => JSON::XS::false()});
+ is( JSON::XS::encode_json( $json4 ), '{"disabled":false}', "JSON::XS shared
false");
+
+ # Using the Types::Serialiser booleans
+ my $json3a = shared_clone({'enabled' => Cpanel::JSON::XS::true});
+ is( Cpanel::JSON::XS::encode_json( $json3a ), '{"enabled":true}',
"Types::Serialiser shared true");
+ my $json4a = shared_clone({'disabled' => Cpanel::JSON::XS::false});
+ is( Cpanel::JSON::XS::encode_json( $json4a ), '{"disabled":false}',
"Types::Serialiser shared false");
+}
+
+SKIP: {
+ eval "require JSON::PP && require JSON::PP::Boolean;";
+ skip "JSON::PP required for testing interop", 2 if $@;
+
+ TODO: {
+ local $TODO = "JSON::PP::Boolean $JSON::PP::VERSION looks broken, upgrade"
+ if $JSON::PP::VERSION > 2.2740001 and $JSON::PP::VERSION < 4.0; # return
null in both cases
+ # 4.02 ok
+ # 2.97001_04 broken
+ # 2.94_01 broken
+ # 2.27400_02 broken
+ # 2.27400_01 ok
+ # 2.27300 ok
+
+ my $json5 = shared_clone({'enabled' => $JSON::PP::true});
+ is( JSON::PP::encode_json( $json5 ), '{"enabled":true}', "JSON::PP shared
true");
+ my $json6 = shared_clone({'disabled' => $JSON::PP::false});
+ is( JSON::PP::encode_json( $json6 ), '{"disabled":false}', "JSON::PP shared
false");
+ }
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/t/12_blessed.t
new/Cpanel-JSON-XS-4.21/t/12_blessed.t
--- old/Cpanel-JSON-XS-4.19/t/12_blessed.t 2019-04-18 16:00:25.000000000
+0200
+++ new/Cpanel-JSON-XS-4.21/t/12_blessed.t 2020-08-12 14:14:01.000000000
+0200
@@ -1,15 +1,16 @@
-BEGIN { $| = 1; print "1..18\n"; }
-
+use strict;
use Cpanel::JSON::XS;
+use Test::More tests => 22;
-our $test;
-sub ok($;$) {
- print $_[0] ? "" : "not ", "ok ", ++$test, $_[1]?"# ".$_[1]:"", "\n";
- $_[0]
-}
+package ZZ;
+use overload ('""' => sub { "<ZZ:".${$_[0]}.">" } );
+
+package main;
+sub XX::TO_JSON { {"__",""} }
-my $o1 = bless { a => 3 }, "XX";
-my $o2 = bless \(my $dummy = 1), "YY";
+my $o1 = bless { a => 3 }, "XX"; # with TO_JSON
+my $o2 = bless \(my $dummy1 = 1), "YY"; # without stringification
+my $o3 = bless \(my $dummy2 = 1), "ZZ"; # with stringification
if (eval 'require Hash::Util') {
if ($Hash::Util::VERSION > 0.05) {
@@ -25,27 +26,39 @@
print "# locked hashes are not supported\n";
};
-sub XX::TO_JSON {
- {__,""}
-}
-
my $js = Cpanel::JSON::XS->new;
-eval { $js->encode ($o1) }; ok ($@ =~ /allow_blessed/);
-eval { $js->encode ($o2) }; ok ($@ =~ /allow_blessed/);
+eval { $js->encode ($o1) }; ok ($@ =~ /allow_blessed/, 'error no
allow_blessed');
+eval { $js->encode ($o2) }; ok ($@ =~ /allow_blessed/, 'error w/o TO_JSON');
+eval { $js->encode ($o3) }; ok ($@ =~ /allow_blessed/, 'error w stringify');
+$js->convert_blessed;
+my $r = $js->encode ($o1);
+ok ($js->encode ($o1) eq '{"__":""}', "convert_blessed with TO_JSON $r");
+$r = "";
+eval { $r = $js->encode ($o2) }; ok ($@ =~ /allow_blessed/, "error w/o TO_JSON
$r @_");
+$r = $js->encode ($o3);
+TODO: {
+ local $TODO = '5.8.x' if $] < 5.010;
+ ok ($r eq '"<ZZ:1>"', "stringify overload with convert_blessed: $r / $o3");
+}
+
+$js = Cpanel::JSON::XS->new;
$js->allow_blessed;
-ok ($js->encode ($o1) eq "null");
-ok ($js->encode ($o2) eq "null");
-$js->allow_blessed(0)->convert_blessed;
-ok ($js->encode ($o1) eq '{"__":""}');
+ok ($js->encode ($o1) eq "null", 'allow_blessed');
ok ($js->encode ($o2) eq "null");
+ok ($js->encode ($o3) eq "null");
$js->allow_blessed->convert_blessed;
-ok ($js->encode ($o1) eq '{"__":""}');
-if ($] < 5.008) {
- print "ok ",++$test," # skip 5.6\n"
-} else {
+ok ($js->encode ($o1) eq '{"__":""}', 'allow_blessed + convert_blessed');
+SKIP: {
+ skip "5.6", 2 if $[ < 5.008;
# PP returns null
- ok ($js->encode ($o2) eq 'null') or print STDERR "# ",$js->encode ($o2),"\n";
+ $r = $js->encode ($o2);
+ ok ($r eq 'null', "$r");
+ $r = $js->encode ($o3);
+ TODO: {
+ local $TODO = '5.8.x' if $] < 5.010;
+ ok ($r eq '"<ZZ:1>"', "stringify $r");
+ }
}
$js->filter_json_object (sub { 5 });
@@ -68,9 +81,8 @@
$js->filter_json_single_key_object ("a");
ok (4 == $js->decode ('[{"a":4}]')->[0]{a});
-if ($]<5.008002) {
- print "ok 18 # skip 5.6 + 5.8.1\n";
-} else {
+SKIP: {
+ skip "5.6 + 5.8.1", 1 if $] < 5.008002;
$js->filter_json_single_key_object (a => sub { });
ok (4 == $js->decode ('[{"a":4}]')->[0]{a});
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/t/16_tied.t
new/Cpanel-JSON-XS-4.21/t/16_tied.t
--- old/Cpanel-JSON-XS-4.19/t/16_tied.t 2015-01-31 20:57:23.000000000 +0100
+++ new/Cpanel-JSON-XS-4.21/t/16_tied.t 2020-08-12 14:14:01.000000000 +0200
@@ -1,22 +1,23 @@
-BEGIN { $| = 1; print "1..2\n"; }
-
+use Test::More tests => 4;
use Cpanel::JSON::XS;
use Tie::Hash;
use Tie::Array;
-our $test;
-sub ok($;$) {
- print $_[0] ? "" : "not ", "ok ", ++$test, "\n";
-}
-
my $js = Cpanel::JSON::XS->new;
tie my %h, 'Tie::StdHash';
%h = (a => 1);
+is ($js->encode (\%h), '{"a":1}');
-ok ($js->encode (\%h) eq '{"a":1}');
+$h{d} = 4;
+$h{c} = 3;
+$h{b} = 2;
+# sort the keys with canonical (GH #167)
+is ($js->canonical->encode (\%h), '{"a":1,"b":2,"c":3,"d":4}');
tie my @a, 'Tie::StdArray';
@a = (1, 2);
+is ($js->encode (\@a), '[1,2]');
-ok ($js->encode (\@a) eq '[1,2]');
+push @a, 0;
+is ($js->canonical->encode (\@a), '[1,2,0]');
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/t/54_stringify.t
new/Cpanel-JSON-XS-4.21/t/54_stringify.t
--- old/Cpanel-JSON-XS-4.19/t/54_stringify.t 2019-05-31 18:27:57.000000000
+0200
+++ new/Cpanel-JSON-XS-4.21/t/54_stringify.t 2020-08-12 13:41:42.000000000
+0200
@@ -69,17 +69,17 @@
$json->allow_unknown->allow_stringify;
$pp->allow_unknown->allow_blessed->convert_blessed;
my $e = $pp->encode( {false => \"some"} ); # pp is a bit inconsistent
-ok( ($e eq '{"false":null}') || ($e eq '{"false":some}'), 'pp stringref' );
-is( $pp->encode ( {false => \""} ), '{"false":null}' );
-is( $pp->encode ( {false => \!!""} ), '{"false":null}' );
-is( $json->encode( {false => \"some"} ), '{"false":"some"}' );
-is( $json->encode( {false => \""} ), '{"false":null}' );
-is( $json->encode( {false => \!!""} ), '{"false":null}' );
+ok( ($e eq '{"false":null}') || ($e eq '{"false":some}'), 'pp \"some"' );
+is( $pp->encode ( {false => \""} ), '{"false":null}', 'pp \""' );
+is( $pp->encode ( {false => \!!""} ), '{"false":null}', 'pp \!!""' );
+is( $json->encode( {false => \"some"} ), '{"false":"some"}', 'js \"some"');
+is( $json->encode( {false => \""} ), '{"false":null}', 'js \""' );
+is( $json->encode( {false => \!!""} ), '{"false":null}', 'js \!!""' );
# GH #124 missing refcnt on stringify result
package BoolTestOk;
use overload '""' => sub {"1"};
package main;
my $data = {nick => bless({}, 'BoolTestOk')};
-is( $json->convert_blessed->allow_blessed->encode($data), '{"nick":"1"}' );
+is( $json->convert_blessed->allow_blessed->encode($data), '{"nick":"1"}', 'GH
#124' );
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.19/xt/kwalitee.t
new/Cpanel-JSON-XS-4.21/xt/kwalitee.t
--- old/Cpanel-JSON-XS-4.19/xt/kwalitee.t 2019-06-10 14:48:06.000000000
+0200
+++ new/Cpanel-JSON-XS-4.21/xt/kwalitee.t 2020-08-12 13:41:42.000000000
+0200
@@ -23,5 +23,10 @@
plan skip_all => 'Test::Kwalitee fails with clang -faddress-sanitizer'
if $Config{ccflags} =~ /-faddress-sanitizer/;
+if ($^V =~ /c$/) {
+ eval "require Module::CPANTS::Kwalitee::Uses;";
+ plan skip_all => 'bad Module::CPANTS::Kwalitee hashpairs'
+ if $Module::CPANTS::Kwalitee::Uses::VERSION eq '1.01';
+}
Test::Kwalitee->import( tests => [ qw( -use_strict ) ] );