Hello community,
here is the log from the commit of package perl-Cpanel-JSON-XS for
openSUSE:Factory checked in at 2017-08-28 15:10:19
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS (Old)
and /work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Cpanel-JSON-XS"
Mon Aug 28 15:10:19 2017 rev:7 rq:516813 version:3.0237
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS/perl-Cpanel-JSON-XS.changes
2017-05-03 15:57:10.880300414 +0200
+++
/work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new/perl-Cpanel-JSON-XS.changes
2017-08-28 15:10:32.952533985 +0200
@@ -1,0 +2,41 @@
+Thu Aug 3 05:16:12 UTC 2017 - [email protected]
+
+- updated to 3.0237
+ see /usr/share/doc/packages/perl-Cpanel-JSON-XS/Changes
+
+ 3.0237 2017-07-28 (rurban)
+ - relax inf/nan tests as in t/op/infnan.t for windows.
+ we cannot know if msvcrt.dll or the new ucrt.dll is used.
+ try a list of valid values.
+
+-------------------------------------------------------------------
+Fri Jul 28 05:15:31 UTC 2017 - [email protected]
+
+- updated to 3.0236
+ see /usr/share/doc/packages/perl-Cpanel-JSON-XS/Changes
+
+ 3.0236 2017-07-27 (rurban)
+ - Stringify true again as "1", not as "true" due to popular demand.
+ (haarg #87)
+
+ 3.0235 2017-07-27 (rurban)
+ - Disallow duplicate keys by default, only allow them in relaxed
+ mode. (#75)
+ Analog to invalid unicode, which does error by default.
+ RFC 7159 section 4 says that "The names within an object should be
unique."
+ So it's either i_ (undefined) or n_ (errors).
+ See http://seriot.ch/parsing_json.php#24
+ This is different to the other JSON modules, which do have a
different
+ interpretation of the spec. Use relaxed for backcompat if you want
to
+ allow duplicate keys.
+ - De-fragilize t/96_mojo.t false test to "". It mostly is.
+
+ 3.0234 2017-07-27 (rurban)
+ - Fix and unify utf8 handling with 5.6.2
+ and improve many utf8 tests. (pali #88)
+ - Add tests for boolean sv_yes and sv_no (pali #88)
+ - Check for correct module in %INC (Patrick Cronin #89)
+ - Fix appveyor smoke with latest strawberry, use $Config{make} (pali
#91)
+ - Fix inf/nan for strawberry 5.26
+
+-------------------------------------------------------------------
Old:
----
Cpanel-JSON-XS-3.0233.tar.gz
New:
----
Cpanel-JSON-XS-3.0237.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Cpanel-JSON-XS.spec ++++++
--- /var/tmp/diff_new_pack.eyrObp/_old 2017-08-28 15:10:34.264349446 +0200
+++ /var/tmp/diff_new_pack.eyrObp/_new 2017-08-28 15:10:34.292345508 +0200
@@ -17,7 +17,7 @@
Name: perl-Cpanel-JSON-XS
-Version: 3.0233
+Version: 3.0237
Release: 0
%define cpan_name Cpanel-JSON-XS
Summary: Cpanel Fork of Json::Xs, Fast and Correct Serializing
++++++ Cpanel-JSON-XS-3.0233.tar.gz -> Cpanel-JSON-XS-3.0237.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/.appveyor.yml
new/Cpanel-JSON-XS-3.0237/.appveyor.yml
--- old/Cpanel-JSON-XS-3.0233/.appveyor.yml 2017-05-01 14:18:48.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/.appveyor.yml 2017-07-27 22:15:44.000000000
+0200
@@ -45,4 +45,4 @@
build: off
test_script:
- - 't\appveyor-test.bat'
+ - cmd: 'call t\appveyor-test.bat'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/.travis.yml
new/Cpanel-JSON-XS-3.0237/.travis.yml
--- old/Cpanel-JSON-XS-3.0233/.travis.yml 2017-03-29 11:51:37.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/.travis.yml 2017-07-27 22:15:44.000000000
+0200
@@ -11,10 +11,11 @@
- "5.20"
- "5.22"
- "5.24"
- - "5.24-thr"
- - "5.24-dbg"
- - "5.24-thr-dbg"
- - "5.24-mb"
+ - "5.26"
+ #- "5.26-thr"
+ #- "5.26-dbg"
+ #- "5.26-thr-dbg"
+ #- "5.26-mb"
- "dev"
# - "blead"
@@ -26,10 +27,10 @@
# directories:
# - /home/travis/perl5/perlbrew/
-#addons:
-# apt:
-# packages:
-# - gperf
+addons:
+ apt:
+ packages:
+ - aspell
# blead and 5.6 stumble over YAML and more missing dependencies
# for Devel::Cover::Report::Coveralls
@@ -39,9 +40,12 @@
- ln -s `which true` /home/travis/bin/cpansign
- eval $(curl https://travis-perl.github.io/init) --auto
install:
- - export AUTOMATED_TESTING=1 HARNESS_TIMER=1 AUTHOR_TESTING=0
RELEASE_TESTING=0
+ - export AUTOMATED_TESTING=1 HARNESS_TIMER=1
- cpan-install --deps # installs prereqs, including recommends
- cpan-install JSON JSON::PP JSON::XS Mojo::JSON Test::LeakTrace Time::Piece
+ - test x$AUTHOR_TESTING = x1 && cpan-install Test::CPAN::Meta
Test::MinimumVersion
+ Pod::Spell::CommonMistakes Class::XSAccessor Test::Kwalitee
Test::Spelling
+ Text::CSV_XS Test::Pod Test::Pod::Coverage
- cpan-install --coverage # installs converage prereqs, if enabled
before_script:
@@ -55,7 +59,7 @@
matrix:
fast_finish: true
include:
- - perl: "5.18"
+ - perl: "5.26"
env: COVERAGE=1 AUTHOR_TESTING=1 # enables coverage+coveralls reporting
allow_failures:
- env: COVERAGE=1 AUTHOR_TESTING=1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/Changes
new/Cpanel-JSON-XS-3.0237/Changes
--- old/Cpanel-JSON-XS-3.0233/Changes 2017-05-01 15:11:15.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/Changes 2017-07-28 11:20:18.000000000 +0200
@@ -2,6 +2,35 @@
TODO: http://stevehanov.ca/blog/index.php?id=104 compression
+3.0237 2017-07-28 (rurban)
+ - relax inf/nan tests as in t/op/infnan.t for windows.
+ we cannot know if msvcrt.dll or the new ucrt.dll is used.
+ try a list of valid values.
+
+3.0236 2017-07-27 (rurban)
+ - Stringify true again as "1", not as "true" due to popular demand.
+ (haarg #87)
+
+3.0235 2017-07-27 (rurban)
+ - Disallow duplicate keys by default, only allow them in relaxed
+ mode. (#75)
+ Analog to invalid unicode, which does error by default.
+ RFC 7159 section 4 says that "The names within an object should be
unique."
+ So it's either i_ (undefined) or n_ (errors).
+ See http://seriot.ch/parsing_json.php#24
+ This is different to the other JSON modules, which do have a
different
+ interpretation of the spec. Use relaxed for backcompat if you want to
+ allow duplicate keys.
+ - De-fragilize t/96_mojo.t false test to "". It mostly is.
+
+3.0234 2017-07-27 (rurban)
+ - Fix and unify utf8 handling with 5.6.2
+ and improve many utf8 tests. (pali #88)
+ - Add tests for boolean sv_yes and sv_no (pali #88)
+ - Check for correct module in %INC (Patrick Cronin #89)
+ - Fix appveyor smoke with latest strawberry, use $Config{make} (pali
#91)
+ - Fix inf/nan for strawberry 5.26
+
3.0233 2017-05-01 (rurban)
- 5.6 test fixes, silence some cc warnings,
add coverage and release targets, fix appveyor
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/MANIFEST
new/Cpanel-JSON-XS-3.0237/MANIFEST
--- old/Cpanel-JSON-XS-3.0233/MANIFEST 2017-05-01 16:54:36.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/MANIFEST 2017-07-28 13:14:53.000000000 +0200
@@ -39,6 +39,7 @@
t/23_array_ctx.t
t/24_freeze_recursion.t
t/25_boolean.t
+t/26_duplicate.t
t/30_jsonspec.t
t/31_bom.t
t/52_object.t
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/META.json
new/Cpanel-JSON-XS-3.0237/META.json
--- old/Cpanel-JSON-XS-3.0233/META.json 2017-05-01 16:54:36.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/META.json 2017-07-28 13:14:53.000000000 +0200
@@ -1,16 +1,16 @@
{
"abstract" : "cPanel fork of JSON::XS, fast and correct serializing",
"author" : [
- "Reini Urban <[email protected]>"
+ "Reini Urban <[email protected]>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter
version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 8.0404, CPAN::Meta::Converter
version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
- "version" : "2"
+ "version" : 2
},
"name" : "Cpanel-JSON-XS",
"no_index" : {
@@ -41,7 +41,6 @@
"bugtracker" : {
"web" : "https://github.com/rurban/Cpanel-JSON-XS/issues"
},
- "homepage" : "http://software.schmorp.de/pkg/JSON-XS.html",
"license" : [
"http://dev.perl.org/licenses/"
],
@@ -49,6 +48,6 @@
"url" : "https://github.com/rurban/Cpanel-JSON-XS"
}
},
- "version" : "3.0233",
- "x_serialization_backend" : "JSON::PP version 2.27400"
+ "version" : "3.0237",
+ "x_serialization_backend" : "JSON::PP version 2.93"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/META.yml
new/Cpanel-JSON-XS-3.0237/META.yml
--- old/Cpanel-JSON-XS-3.0233/META.yml 2017-05-01 16:54:35.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/META.yml 2017-07-28 13:14:53.000000000 +0200
@@ -1,13 +1,13 @@
---
abstract: 'cPanel fork of JSON::XS, fast and correct serializing'
author:
- - 'Reini Urban <[email protected]>'
+ - 'Reini Urban <[email protected]>'
build_requires:
ExtUtils::MakeMaker: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version
2.150010'
+generated_by: 'ExtUtils::MakeMaker version 8.0404, CPAN::Meta::Converter
version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -21,8 +21,7 @@
Pod::Text: '2.08'
resources:
bugtracker: https://github.com/rurban/Cpanel-JSON-XS/issues
- homepage: http://software.schmorp.de/pkg/JSON-XS.html
license: http://dev.perl.org/licenses/
repository: https://github.com/rurban/Cpanel-JSON-XS
-version: '3.0233'
+version: '3.0237'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/Makefile.PL
new/Cpanel-JSON-XS-3.0237/Makefile.PL
--- old/Cpanel-JSON-XS-3.0233/Makefile.PL 2017-05-01 14:23:34.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/Makefile.PL 2017-07-27 22:28:41.000000000
+0200
@@ -29,7 +29,7 @@
LICENSE => 'perl',
($] >= 5.005 ?
(ABSTRACT_FROM => 'XS.pm',
- AUTHOR => 'Reini Urban <[email protected]>',
+ AUTHOR => 'Reini Urban <[email protected]>',
# ORIGINAL_AUTHOR => 'Marc Lehmann <[email protected]>'
) : ()),
($ExtUtils::MakeMaker::VERSION gt '6.46'
@@ -67,7 +67,6 @@
bugtracker => 'https://github.com/rurban/Cpanel-JSON-XS/issues',
# Note:
https://rt.cpan.org/Public/Dist/Display.html?Queue=Cpanel-JSON-XS is also
observed
repository => 'https://github.com/rurban/Cpanel-JSON-XS',
- homepage => 'http://software.schmorp.de/pkg/JSON-XS.html',
},
}
) : ()),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/README
new/Cpanel-JSON-XS-3.0237/README
--- old/Cpanel-JSON-XS-3.0233/README 2017-05-01 16:54:37.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/README 2017-07-28 13:14:54.000000000 +0200
@@ -123,7 +123,8 @@
- interop for true/false overloading. JSON::XS, JSON::PP and Mojo::JSON
representations for booleans are accepted and JSON::XS accepts
Cpanel::JSON::XS booleans [#13, #37] Fixed overloading of booleans.
- Cpanel::JSON::XS::true stringifies now to true, not 1.
+ Cpanel::JSON::XS::true stringifies again to "1", not "true", analog to
+ all other JSON modules.
- native boolean mapping of yes and no to true and false, as in
YAML::XS. In perl "!0" is yes, "!1" is no. The JSON value true maps to
@@ -166,12 +167,13 @@
- extended testsuite, passes all http://seriot.ch/parsing_json.html
tests. In fact it is the only know JSON decoder which does so, while
- being the fastest.
+ also being the fastest.
- support many more options and methods from JSON::PP: stringify_infnan,
allow_unknown, allow_stringify, allow_barekey, encode_stringify,
allow_bignum, allow_singlequote, sort_by (partially), escape_slash,
- convert_blessed, ... optional decode_json(, allow_nonref) arg
+ convert_blessed, ... optional decode_json(, allow_nonref) arg. relaxed
+ implements allow_dupkeys.
- support all 5 unicode BOM's: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE,
UTF-32BE, encoding internally to UTF-8.
@@ -541,6 +543,13 @@
{ foo:"bar" }
+ * duplicate keys
+
+ With relaxed decoding of duplicate keys does not error and are
+ silently accepted. See <http://seriot.ch/parsing_json.php#24>:
+ RFC 7159 section 4: "The names within an object should be
+ unique."
+
$json = $json->canonical ([$enable])
$enabled = $json->get_canonical
If $enable is true (or missing), then the "encode" method will
@@ -1301,7 +1310,7 @@
respectively. You can also use "\1" and "\0" or "!0" and "!1"
directly if you want.
- encode_json [Cpanel::JSON::XS::true, Cpanel::JSON::XS::true] #
yields [false,true]
+ encode_json [Cpanel::JSON::XS::true, Cpanel::JSON::XS::true] #
yields [false,true]
encode_json [!1, !0] # yields [false,true]
blessed objects
@@ -1983,7 +1992,7 @@
AUTHOR
Marc Lehmann <[email protected]>, http://home.schmorp.de/
- Reini Urban <[email protected]>, http://cpanel.net/
+ Reini Urban <[email protected]>
MAINTAINER
Reini Urban <[email protected]>
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/SIGNATURE
new/Cpanel-JSON-XS-3.0237/SIGNATURE
--- old/Cpanel-JSON-XS-3.0233/SIGNATURE 2017-05-01 16:54:36.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/SIGNATURE 2017-07-28 13:14:54.000000000 +0200
@@ -14,25 +14,25 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
-SHA1 b1dc76bb84e636c3d4a32dc6676ae3259fa25aeb .appveyor.yml
-SHA1 bddff1b119b111563d9c812b92e28289c3ea450e .travis.yml
+SHA1 66ade5a767190219d6892f1e4d59fea22be138d8 .appveyor.yml
+SHA1 041783628ea621df1271501c341141be0c4cd0c2 .travis.yml
SHA1 9a56f3b919dfc8fced3803e165a2e38de62646e5 COPYING
-SHA1 7eb2da232117269dbdd796c7eb869d7b143ea767 Changes
-SHA1 dddd524be72a6784fc85f96bd6f054bba0f3cd26 MANIFEST
-SHA1 1b54ffa91cf810f678afdece79df596f0e2c77ff META.json
-SHA1 5232306e51deaf16449d2336f1cce6a3163b3144 META.yml
-SHA1 7ddbf57c8a0b04ca11e50c1fcf534ec19b2a0806 Makefile.PL
-SHA1 5f9c081e4f784fbfccc7df27bf386da13f3b6301 README
-SHA1 faf7ee3dcf51ca9dee6c8ab4864632cfcf2aa0b8 XS.pm
-SHA1 de4fa143391188f9de660d068715fe134a1ba97c XS.xs
+SHA1 05e39fba1f3550cca1f9d6f15fb2fd472b133fa6 Changes
+SHA1 1cb5b409cb86b392753ca0ea2d6ba718f104b128 MANIFEST
+SHA1 0293f584ff61e62d9a5efea0bb74191a93eaae62 META.json
+SHA1 dc0b25e34b021a66f298791270c523c70812b347 META.yml
+SHA1 9f4e725e4e2fa7e255d1fce4314446c77da64035 Makefile.PL
+SHA1 ad85457cffa84dc07f9016b170f0ea7894a2b5eb README
+SHA1 9a3fda3cb684c8a4d482472640aa0e38de6e55a7 XS.pm
+SHA1 3022dd0522d14476779a21d7d9ad550bbea4a3a3 XS.xs
SHA1 27b0bc7e0cd6fe90876fb3d285065c6a07cca028 XS/Boolean.pm
SHA1 9e4b04d1af085e6959aaed51734475d350136392 bin/cpanel_json_xs
SHA1 ea72bbe602baaabdd0004ef1d7e7cc3334b42bb4 eg/bench
SHA1 6e5d2153e1931be4e416c8feef7f7dfcab0f91b4 ppport.h
SHA1 f7101031fd3fde35fe2421a07ab6cee8a822c00c t/00_load.t
-SHA1 2e04c54c8e6bf0d8090bcbc17487238a98f5e0aa t/01_utf8.t
+SHA1 c8f0471da3ab4cab5e197a5362e24c0e2958f589 t/01_utf8.t
SHA1 9cf542e0bf68c90749420c7d07d7be80e1860592 t/02_error.t
-SHA1 1dbcee8e27652d901af1c7f03a06a081e3b69092 t/03_types.t
+SHA1 7ceff3f6fafe1ca6c3bb1c6e3042178753966013 t/03_types.t
SHA1 d876bdffc381f4f67ec90f9c331e3ec2138946e2 t/04_dwiw_encode.t
SHA1 94b1130a9b760102e0a24ad518f1e7439ef9122c t/05_dwiw_decode.t
SHA1 d8c75d0fc7061469eba29275eb366b593c156f7d t/06_pc_pretty.t
@@ -53,7 +53,7 @@
SHA1 8dece990d5b07df0ae1b6364caefced774cb587d t/114_decode_prefix.t
SHA1 eb050780996f1e428c87bf6375415ca4c863cbb2 t/115_tie_ixhash.t
SHA1 3477b0490b8666e451ac15df97f9f35d72c946b1 t/116_incr_parse_fixed.t
-SHA1 528c68984530cf1a3bdfbdb6c0792b23255552b9 t/117_numbers.t
+SHA1 5dc6d574882edd0d6c49ec3d5daeb8d9d4afc246 t/117_numbers.t
SHA1 d1003d09b5da3609977362bcda64b2c593039a6b t/11_pc_expo.t
SHA1 c0037e62cefc891df4bb84a110051963a60e9f8c t/12_blessed.t
SHA1 4d553fd6b5e4486f087babff2946e0cb4b2c38fb t/13_limit.t
@@ -69,8 +69,9 @@
SHA1 3d155f37e687f929bd0cae767dc2dbf1993b73c9 t/22_comment_at_eof.t
SHA1 1ffb0242c800720c565a9e148e184bfa9d54b1c4 t/23_array_ctx.t
SHA1 2d2ccc7877250f80755a74acd0c3c2f21e606aae t/24_freeze_recursion.t
-SHA1 de63833eb7d922d21339a210680ebf84508b987a t/25_boolean.t
-SHA1 e69768ad5d6900497ab088e74473b3208e3a4bbd t/30_jsonspec.t
+SHA1 b1af7c633a8654de5180ae42289f8fe6d86263de t/25_boolean.t
+SHA1 b731e24e61fd24c19c7b2e636bf20b368fbc851e t/26_duplicate.t
+SHA1 7f4c74f3c46477c513a2baf07a60c94969d2e0e9 t/30_jsonspec.t
SHA1 3705a4bc706627dde26e444f41342b88850cbe98 t/31_bom.t
SHA1 ded6191143511074b0cfa5c7ff990e0cbaa11ff9 t/52_object.t
SHA1 292cb103dae404294cb77c68e3f28a1239f603b9 t/53_readonly.t
@@ -78,12 +79,12 @@
SHA1 f08d2ec9499dc0d0e5ede5691c75b865f466b69c t/55_modifiable.t
SHA1 7ad4a15bfdec5bbd757a48a4670f0275fb2ffd71 t/96_interop.t
SHA1 1caf7492922f42dd78cf34b2de7bba5481f84fd8 t/96_interop_pp.t
-SHA1 711a469b7cf72b40bbe94ce65264d1c0a3f0a016 t/96_mojo.t
+SHA1 758322045b9e08bfd98122a662950eb86efb7180 t/96_mojo.t
SHA1 3291c73ec3a19df551d0fff59695153616fc982a t/97_unshare_hek.t
SHA1 1bf6336a76101f747b84c35cca38c4e8bacb9224 t/98_56only.t
SHA1 e5e4ea9e68154f9adb4e5e19a86c96efb1704d02 t/99_binary.t
SHA1 e6078e2fc5c375d45498494bb91487834601a189 t/_unicode_handling.pm
-SHA1 4fe1bc58fd22b56b331ef2050977bd488588919a t/appveyor-test.bat
+SHA1 ef62decbf1634f795ef03babe0b36ab9855f263b t/appveyor-test.bat
SHA1 483157c2a683750b52011f4b6cc00fc3b4381d9a t/gh70-asan.t
SHA1 413be8df242f37f68aa3841888174e545cba5b2f
t/test_parsing/i_number_neg_int_huge_exp.json
SHA1 fa1cc74fc07e84b1a18883a4f5e85472c41df793
t/test_parsing/i_number_pos_double_huge_exp.json
@@ -424,7 +425,7 @@
SHA1 5cd847ba5ed5d1a90807dbf8891bf1690918cb5e t/z_kwalitee.t
SHA1 6dfd7f5112f80b65e84916c780a0b1a71aad32dc t/z_leaktrace.t
SHA1 e3259ac6c4bd7f3349cf6f2ff829827483bc749d t/z_meta.t
-SHA1 741e9e8bf600c7f7441794fe49ea8904cfd4bf58 t/z_perl_minimum_version.t
+SHA1 204e8376b847824292d6630be5b0ecfb54ad9a2b t/z_perl_minimum_version.t
SHA1 d91cc1b39fcb1dbf23c11ebb5885cfaaeb2c3a50 t/z_pod-coverage.t
SHA1 2eb526b1649c6306df677d7ae63433856b672476 t/z_pod-spell-mistakes.t
SHA1 6e74cfbeb5080643d126b9d74f2f7e6dad26b013 t/z_pod-spelling.t
@@ -433,7 +434,7 @@
SHA1 e93c9b53438be114c25aa426742e24f4343057a7 typemap
-----BEGIN PGP SIGNATURE-----
-iF0EARECAB0WIQRZHhhUcL58V8z0UW2abZJij/3JQgUCWQdMLAAKCRCabZJij/3J
-Qij9AJ0WBByTlFpF82C91mJ1SncHd6/k0wCeO6iIEafqRW21gWAF+GrNnPvvHYg=
-=wI+L
+iF0EARECAB0WIQRZHhhUcL58V8z0UW2abZJij/3JQgUCWXscrQAKCRCabZJij/3J
+QuLWAJ9MygjIcjr3je/GWcbxuToLjGUADwCgi4KIy98+e+HNEpVgBKEy+pqXeec=
+=7QEI
-----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/XS.pm
new/Cpanel-JSON-XS-3.0237/XS.pm
--- old/Cpanel-JSON-XS-3.0233/XS.pm 2017-05-01 15:11:32.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/XS.pm 2017-07-28 11:20:18.000000000 +0200
@@ -1,7 +1,7 @@
package Cpanel::JSON::XS;
-our $VERSION = '3.0233';
+our $VERSION = '3.0237';
our $XS_VERSION = $VERSION;
-$VERSION = eval $VERSION;
+# $VERSION = eval $VERSION;
=pod
@@ -112,16 +112,17 @@
- stricter decode_json() as documented. non-refs are disallowed.
added a 2nd optional argument. decode() honors now allow_nonref.
-- fixed encode of numbers for dual-vars. Different string representations
- are preserved, but numbers with temporary strings which represent the same
number
- are here treated as numbers, not strings. Cpanel::JSON::XS is a bit slower,
but
- preserves numeric types better.
-
-- numbers ending with .0 stay numbers, are not converted to integers. [#63]
- dual-vars which are represented as number not integer (42+"bar" != 5.8.9)
- are now encoded as number (=> 42.0) because internally it's now a NOK type.
- However !!1 which is wrongly encoded in 5.8 as "1"/1.0 is still represented
- as integer.
+- fixed encode of numbers for dual-vars. Different string
+ representations are preserved, but numbers with temporary strings
+ which represent the same number are here treated as numbers, not
+ strings. Cpanel::JSON::XS is a bit slower, but preserves numeric
+ types better.
+
+- numbers ending with .0 stay numbers, are not converted to
+ integers. [#63] dual-vars which are represented as number not
+ integer (42+"bar" != 5.8.9) are now encoded as number (=> 42.0)
+ because internally it's now a NOK type. However !!1 which is
+ wrongly encoded in 5.8 as "1"/1.0 is still represented as integer.
- different handling of inf/nan. Default now to null, optionally with
stringify_infnan() to "inf"/"nan". [#28, #32]
@@ -129,14 +130,14 @@
- added C<binary> extension, non-JSON and non JSON parsable, allows
C<\xNN> and C<\NNN> sequences.
-- 5.6.2 support; sacrificing some utf8 features (assuming bytes all-over),
- no multi-byte unicode characters with 5.6.
+- 5.6.2 support; sacrificing some utf8 features (assuming bytes
+ all-over), no multi-byte unicode characters with 5.6.
- interop for true/false overloading. JSON::XS, JSON::PP and Mojo::JSON
representations for booleans are accepted and JSON::XS accepts
Cpanel::JSON::XS booleans [#13, #37]
- Fixed overloading of booleans. Cpanel::JSON::XS::true stringifies now
- to true, not 1.
+ Fixed overloading of booleans. Cpanel::JSON::XS::true stringifies again
+ to "1", not "true", analog to all other JSON modules.
- native boolean mapping of yes and no to true and false, as in YAML::XS.
In perl C<!0> is yes, C<!1> is no.
@@ -174,20 +175,22 @@
- use ppport.h, sanify XS.xs comment styles, harness C coding style
-- common::sense is optional. When available it is not used in the published
- production module, just during development and testing.
+- common::sense is optional. When available it is not used in the
+ published production module, just during development and testing.
-- extended testsuite, passes all http://seriot.ch/parsing_json.html tests.
- In fact it is the only know JSON decoder which does so, while being the
fastest.
+- extended testsuite, passes all http://seriot.ch/parsing_json.html
+ tests. In fact it is the only know JSON decoder which does so,
+ while also being the fastest.
- support many more options and methods from JSON::PP:
stringify_infnan, allow_unknown, allow_stringify, allow_barekey,
- encode_stringify, allow_bignum, allow_singlequote, sort_by (partially),
- escape_slash, convert_blessed, ...
- optional decode_json(, allow_nonref) arg
+ encode_stringify, allow_bignum, allow_singlequote, sort_by
+ (partially), escape_slash, convert_blessed, ... optional
+ decode_json(, allow_nonref) arg.
+ relaxed implements allow_dupkeys.
-- support all 5 unicode BOM's: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE, UTF-32BE,
- encoding internally to UTF-8.
+- support all 5 unicode BOM's: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE,
+ UTF-32BE, encoding internally to UTF-8.
=cut
@@ -197,7 +200,9 @@
sub to_json($@) {
if ($] >= 5.008) {
require Carp;
- Carp::croak ("Cpanel::JSON::XS::to_json has been renamed to encode_json,
either downgrade to pre-2.0 versions of Cpanel::JSON::XS or rename the call");
+ Carp::croak ("Cpanel::JSON::XS::to_json has been renamed to encode_json,".
+ " either downgrade to pre-2.0 versions of Cpanel::JSON::XS
or".
+ " rename the call");
} else {
_to_json(@_);
}
@@ -206,7 +211,9 @@
sub from_json($@) {
if ($] >= 5.008) {
require Carp;
- Carp::croak ("Cpanel::JSON::XS::from_json has been renamed to
decode_json, either downgrade to pre-2.0 versions of Cpanel::JSON::XS or rename
the call");
+ Carp::croak ("Cpanel::JSON::XS::from_json has been renamed to
decode_json,".
+ " either downgrade to pre-2.0 versions of Cpanel::JSON::XS
or".
+ " rename the call");
} else {
_from_json(@_);
}
@@ -235,9 +242,9 @@
=item $perl_scalar = decode_json $json_text [, $allow_nonref ]
-The opposite of C<encode_json>: expects an UTF-8 (binary) string of an json
reference
-and tries to parse that as an UTF-8 encoded JSON text, returning the resulting
-reference. Croaks on error.
+The opposite of C<encode_json>: expects an UTF-8 (binary) string of an
+json reference and tries to parse that as an UTF-8 encoded JSON text,
+returning the resulting reference. Croaks on error.
This function call is functionally identical to:
@@ -249,18 +256,20 @@
3.0116 and JSON::XS did not set allow_nonref but allowed them due to a
bug in the decoder.
-If the new optional $allow_nonref argument is set and not false, the
allow_nonref
-option will be set and the function will act is described as in the relaxed
RFC 7159
-allowing all values such as objects, arrays, strings, numbers, "null", "true",
and "false".
+If the new optional $allow_nonref argument is set and not false, the
+allow_nonref option will be set and the function will act is described
+as in the relaxed RFC 7159 allowing all values such as objects,
+arrays, strings, numbers, "null", "true", and "false".
=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>, respectively
-and are used to represent JSON C<true> and C<false> values in Perl.
+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>,
+respectively and are used to represent JSON C<true> and C<false>
+values in Perl.
-See MAPPING, below, for more information on how JSON values are mapped to
-Perl.
+See MAPPING, below, for more information on how JSON values are mapped
+to Perl.
=back
@@ -294,27 +303,29 @@
=item 2. Perl does I<not> associate an encoding with your strings.
... until you force it to, e.g. when matching it against a regex, or
-printing the scalar to a file, in which case Perl either interprets your
-string as locale-encoded text, octets/binary, or as Unicode, depending
-on various settings. In no case is an encoding stored together with your
-data, it is I<use> that decides encoding, not any magical meta data.
+printing the scalar to a file, in which case Perl either interprets
+your string as locale-encoded text, octets/binary, or as Unicode,
+depending on various settings. In no case is an encoding stored
+together with your data, it is I<use> that decides encoding, not any
+magical meta data.
=item 3. The internal utf-8 flag has no meaning with regards to the
encoding of your string.
-=item 4. A "Unicode String" is simply a string where each character can be
-validly interpreted as a Unicode code point.
+=item 4. A "Unicode String" is simply a string where each character
+can be validly interpreted as a Unicode code point.
-If you have UTF-8 encoded data, it is no longer a Unicode string, but a
-Unicode string encoded in UTF-8, giving you a binary string.
+If you have UTF-8 encoded data, it is no longer a Unicode string, but
+a Unicode string encoded in UTF-8, giving you a binary string.
-=item 5. A string containing "high" (> 255) character values is I<not> a UTF-8
string.
+=item 5. A string containing "high" (> 255) character values is I<not>
+a UTF-8 string.
=item 6. Unicode noncharacters only warn, as in core.
-The 66 Unicode noncharacters U+FDD0..U+FDEF, and U+*FFFE, U+*FFFF just warn,
-see L<http://www.unicode.org/versions/corrigendum9.html>.
-But illegal surrogate pairs fail to parse.
+The 66 Unicode noncharacters U+FDD0..U+FDEF, and U+*FFFE, U+*FFFF just
+warn, see L<http://www.unicode.org/versions/corrigendum9.html>. But
+illegal surrogate pairs fail to parse.
=item 7. Raw non-Unicode characters above U+10FFFF are disallowed.
@@ -409,9 +420,9 @@
If the C<$enable> argument is true (or missing), then the C<encode>
method will not try to detect an UTF-8 encoding in any JSON string, it
will strictly interpret it as byte sequence. The result might contain
-new C<\xNN> sequences, which is B<unparsable JSON>. The C<decode> method
-forbids C<\uNNNN> sequences and accepts C<\xNN> and octal C<\NNN>
-sequences.
+new C<\xNN> sequences, which is B<unparsable JSON>. The C<decode>
+method forbids C<\uNNNN> sequences and accepts C<\xNN> and octal
+C<\NNN> sequences.
There is also a special logic for perl 5.6 and utf8. 5.6 encodes any
string to utf-8 automatically when seeing a codepoint >= C<0x80> and
@@ -506,9 +517,9 @@
=item $enabled = $json->get_indent
-If C<$enable> is true (or missing), then the C<encode> method will use a
multiline
-format as output, putting every array member or object/hash key-value pair
-into its own line, indenting them properly.
+If C<$enable> is true (or missing), then the C<encode> method will use
+a multiline format as output, putting every array member or
+object/hash key-value pair into its own line, indenting them properly.
If C<$enable> is false, no newlines or indenting will be produced, and the
resulting JSON text is guaranteed not to contain any C<newlines>.
@@ -537,10 +548,10 @@
=item $enabled = $json->get_space_after
-If C<$enable> is true (or missing), then the C<encode> method will add an extra
-optional space after the C<:> separating keys from values in JSON objects
-and extra whitespace after the C<,> separating key-value pairs and array
-members.
+If C<$enable> is true (or missing), then the C<encode> method will add
+an extra optional space after the C<:> separating keys from values in
+JSON objects and extra whitespace after the C<,> separating key-value
+pairs and array members.
If C<$enable> is false, then the C<encode> method will not add any extra
space at those places.
@@ -623,6 +634,12 @@
{ foo:"bar" }
+=item * duplicate keys
+
+With relaxed decoding of duplicate keys does not error and are silently
accepted.
+See L<http://seriot.ch/parsing_json.php#24>:
+RFC 7159 section 4: "The names within an object should be unique."
+
=back
@@ -630,8 +647,9 @@
=item $enabled = $json->get_canonical
-If C<$enable> is true (or missing), then the C<encode> method will output JSON
objects
-by sorting their keys. This is adding a comparatively high overhead.
+If C<$enable> is true (or missing), then the C<encode> method will
+output JSON objects by sorting their keys. This is adding a
+comparatively high overhead.
If C<$enable> is false, then the C<encode> method will output key-value
pairs in the order Perl stores them (which will likely change between runs
@@ -705,7 +723,6 @@
$json->allow_barekey->decode('{foo:"bar"}');
-
=item $json = $json->allow_bignum ([$enable])
=item $enabled = $json->get_allow_bignum
@@ -716,8 +733,9 @@
the big integer Perl cannot handle as integer into a L<Math::BigInt>
object and convert a floating number (any) into a L<Math::BigFloat>.
-On the contrary, C<encode> converts C<Math::BigInt> objects and
C<Math::BigFloat>
-objects into JSON numbers with C<allow_blessed> enable.
+On the contrary, C<encode> converts C<Math::BigInt> objects and
+C<Math::BigFloat> objects into JSON numbers with C<allow_blessed>
+enable.
$json->allow_nonref->allow_blessed->allow_bignum;
$bigfloat = $json->decode('2.000000000000000000000000001');
@@ -736,10 +754,10 @@
=item $enabled = $json->get_allow_nonref
-If C<$enable> is true (or missing), then the C<encode> method can convert a
-non-reference into its corresponding string, number or null JSON value,
-which is an extension to RFC4627. Likewise, C<decode> will accept those JSON
-values instead of croaking.
+If C<$enable> is true (or missing), then the C<encode> method can
+convert a non-reference into its corresponding string, number or null
+JSON value, which is an extension to RFC4627. Likewise, C<decode> will
+accept those JSON values instead of croaking.
If C<$enable> is false, then the C<encode> method will croak if it isn't
passed an arrayref or hashref, as JSON texts must either be an object
@@ -1001,21 +1019,21 @@
Stringified via sprintf(%g), with double quotes.
inf/nan: infnan_mode = 2. As in JSON::XS, and older releases.
-Passes through platform dependent values, invalid JSON. Stringified via
sprintf(%g),
-but without double quotes.
+Passes through platform dependent values, invalid JSON. Stringified via
+sprintf(%g), but without double quotes.
-"inf/-inf/nan": infnan_mode = 3. Platform independent inf/nan/-inf strings.
-No QNAN/SNAN/negative NAN support, unified to "nan". Much easier to detect,
but may
-conflict with valid strings.
+"inf/-inf/nan": infnan_mode = 3. Platform independent inf/nan/-inf
+strings. No QNAN/SNAN/negative NAN support, unified to "nan". Much
+easier to detect, but may conflict with valid strings.
=item $json_text = $json->encode ($perl_scalar)
Converts the given Perl data structure (a simple scalar or a reference
to a hash or array) to its JSON representation. Simple scalars will be
-converted into JSON string or number sequences, while references to arrays
-become JSON arrays and references to hashes become JSON objects. Undefined
-Perl values (e.g. C<undef>) become JSON C<null> values. Neither C<true>
-nor C<false> values will be generated.
+converted into JSON string or number sequences, while references to
+arrays become JSON arrays and references to hashes become JSON
+objects. Undefined Perl values (e.g. C<undef>) become JSON C<null>
+values. Neither C<true> nor C<false> values will be generated.
=item $perl_scalar = $json->decode ($json_text)
@@ -1061,14 +1079,14 @@
is much more efficient (and can be implemented with a minimum of method
calls).
-Cpanel::JSON::XS will only attempt to parse the JSON text once it is sure it
-has enough text to get a decisive result, using a very simple but
-truly incremental parser. This means that it sometimes won't stop as
-early as the full parser, for example, it doesn't detect mismatched
-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. C<max_size>) to ensure the parser will stop
-parsing in the presence if syntax errors.
+Cpanel::JSON::XS will only attempt to parse the JSON text once it is
+sure it has enough text to get a decisive result, using a very simple
+but truly incremental parser. This means that it sometimes won't stop
+as early as the full parser, for example, it doesn't detect mismatched
+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. C<max_size>) to ensure the
+parser will stop parsing in the presence if syntax errors.
The following methods implement this incremental parser.
@@ -1148,15 +1166,16 @@
=head2 LIMITATIONS
All options that affect decoding are supported, except
-C<allow_nonref>. The reason for this is that it cannot be made to
-work sensibly: JSON objects and arrays are self-delimited, i.e. you can
concatenate
-them back to back and still decode them perfectly. This does not hold true
-for JSON numbers, however.
-
-For example, is the string C<1> a single JSON number, or is it simply the
-start of C<12>? Or is C<12> a single JSON number, or the concatenation
-of C<1> and C<2>? In neither case you can tell, and this is why
Cpanel::JSON::XS
-takes the conservative route and disallows this case.
+C<allow_nonref>. The reason for this is that it cannot be made to work
+sensibly: JSON objects and arrays are self-delimited, i.e. you can
+concatenate them back to back and still decode them perfectly. This
+does not hold true for JSON numbers, however.
+
+For example, is the string C<1> a single JSON number, or is it simply
+the start of C<12>? Or is C<12> a single JSON number, or the
+concatenation of C<1> and C<2>? In neither case you can tell, and this
+is why Cpanel::JSON::XS takes the conservative route and disallows
+this case.
=head2 EXAMPLES
@@ -1222,11 +1241,11 @@
but you cannot load it into memory fully (this has actually happened in
the real world :).
-Well, you lost, you have to implement your own JSON parser. But
Cpanel::JSON::XS
-can still help you: You implement a (very simple) array parser and let
-JSON decode the array elements, which are all full JSON objects on their
-own (this wouldn't work if the array elements could be JSON numbers, for
-example):
+Well, you lost, you have to implement your own JSON parser. But
+Cpanel::JSON::XS can still help you: You implement a (very simple)
+array parser and let JSON decode the array elements, which are all
+full JSON objects on their own (this wouldn't work if the array
+elements could be JSON numbers, for example):
my $json = new Cpanel::JSON::XS;
@@ -1312,15 +1331,15 @@
See also L<http://www.unicode.org/faq/utf_bom.html#BOM>.
-Beware that Cpanel::JSON::XS is currently the only JSON module which does
accept
-and decode a BOM.
+Beware that Cpanel::JSON::XS is currently the only JSON module which
+does accept and decode a BOM.
=head1 MAPPING
-This section describes how Cpanel::JSON::XS maps Perl values to JSON values and
-vice versa. These mappings are designed to "do the right thing" in most
-circumstances automatically, preserving round-tripping characteristics
-(what you put in comes out as something equivalent).
+This section describes how Cpanel::JSON::XS maps Perl values to JSON
+values and vice versa. These mappings are designed to "do the right
+thing" in most circumstances automatically, preserving round-tripping
+characteristics (what you put in comes out as something equivalent).
For the more enlightened: note that in the following descriptions,
lowercase I<perl> refers to the Perl interpreter, while uppercase I<Perl>
@@ -1354,12 +1373,12 @@
the conversion details, but an integer may take slightly less memory and
might represent more values exactly than floating point numbers.
-If the number consists of digits only, Cpanel::JSON::XS will try to represent
-it as an integer value. If that fails, it will try to represent it as
-a numeric (floating point) value if that is possible without loss of
-precision. Otherwise it will preserve the number as a string value (in
-which case you lose roundtripping ability, as the JSON number will be
-re-encoded to a JSON string).
+If the number consists of digits only, Cpanel::JSON::XS will try to
+represent it as an integer value. If that fails, it will try to
+represent it as a numeric (floating point) value if that is possible
+without loss of precision. Otherwise it will preserve the number as a
+string value (in which case you lose roundtripping ability, as the
+JSON number will be re-encoded to a JSON string).
Numbers containing a fractional or exponential part will always be
represented as numeric (floating point) values, possibly at a loss of
@@ -1454,7 +1473,7 @@
respectively. You can also use C<\1> and C<\0> or C<!0> and C<!1>
directly if you want.
- encode_json [Cpanel::JSON::XS::true, Cpanel::JSON::XS::true] # yields
[false,true]
+ encode_json [Cpanel::JSON::XS::true, Cpanel::JSON::XS::true] # yields
[false,true]
encode_json [!1, !0] # yields [false,true]
=item blessed objects
@@ -1530,9 +1549,9 @@
=head3 SERIALIZATION
-What happens when C<Cpanel::JSON::XS> encounters a Perl object depends on the
-C<allow_blessed>, C<convert_blessed> and C<allow_tags> settings, which are
-used in this order:
+What happens when C<Cpanel::JSON::XS> encounters a Perl object depends
+on the C<allow_blessed>, C<convert_blessed> and C<allow_tags>
+settings, which are used in this order:
=over 4
@@ -2178,7 +2197,7 @@
sub is_bool($) {
shift if @_ == 2; # as method call
(ref($_[0]) and UNIVERSAL::isa( $_[0], JSON::PP::Boolean::))
- or (exists $INC{'Types/Serializer.pm'} and Types::Serialiser::is_bool($_[0]))
+ or (exists $INC{'Types/Serialiser.pm'} and Types::Serialiser::is_bool($_[0]))
}
XSLoader::load 'Cpanel::JSON::XS', $XS_VERSION;
@@ -2194,11 +2213,11 @@
"0+" => sub { ${$_[0]} },
"++" => sub { $_[0] = ${$_[0]} + 1 },
"--" => sub { $_[0] = ${$_[0]} - 1 },
- '""' => sub { ${$_[0]} == 1 ? 'true' : '0' }, # GH 29
+ '""' => sub { ${$_[0]} == 1 ? '1' : '0' }, # GH 29
'eq' => sub {
my ($obj, $op) = ref ($_[0]) ? ($_[0], $_[1]) : ($_[1], $_[0]);
if ($op eq 'true' or $op eq 'false') {
- return "$obj" eq 'true' ? 'true' eq $op : 'false' eq $op;
+ return "$obj" eq '1' ? 'true' eq $op : 'false' eq $op;
}
else {
return $obj ? 1 == $op : 0 == $op;
@@ -2227,7 +2246,7 @@
Marc Lehmann <[email protected]>, http://home.schmorp.de/
-Reini Urban <[email protected]>, http://cpanel.net/
+Reini Urban <[email protected]>
=head1 MAINTAINER
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/XS.xs
new/Cpanel-JSON-XS-3.0237/XS.xs
--- old/Cpanel-JSON-XS-3.0233/XS.xs 2017-05-01 14:33:02.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/XS.xs 2017-07-28 11:20:18.000000000 +0200
@@ -36,22 +36,20 @@
#define UTF32BOM "\377\376\000\000" /* FF FE 00 00 or +UFEFF */
#define UTF32BOM_BE "\000\000\376\377" /* 00 00 FE FF */
-/* strawberry 5.22 with USE_MINGW_ANSI_STDIO and USE_LONG_DOUBLE has now
- a proper inf/nan */
+/* mingw with USE_LONG_DOUBLE (and implied USE_MINGW_ANSI_STDIO) do use the
+ non-msvcrt inf/nan stringification in sprintf(). */
#if defined(WIN32) && !defined(__USE_MINGW_ANSI_STDIO) &&
!defined(USE_LONG_DOUBLE)
-# if _MSC_VER > 1800
-# define STR_INF "inf"
-# define STR_INF2 "inf.0"
-# define STR_NAN "nan"
-# define STR_QNAN "nan(ind)"
-# define HAVE_QNAN
-# else
-# define STR_INF "1.#INF"
-# define STR_INF2 "1.#INF.0"
-# define STR_NAN "1.#IND"
-# define STR_QNAN "1.#QNAN"
-# define HAVE_QNAN
-# endif
+/* new ucrtd.dll runtime? We do not probe the runtime or variants in the
Makefile.PL yet. */
+#define STR_INF "inf"
+#define STR_INF2 "inf.0"
+#define STR_NAN "nan"
+#define STR_QNAN "nan(ind)"
+/* old standard msvcrt.dll */
+#define STR_INF3 "1.#INF"
+#define STR_INF4 "1.#INF.0"
+#define STR_NAN2 "1.#IND"
+#define STR_QNAN2 "1.#QNAN"
+#define HAVE_QNAN
#elif defined(sun) || defined(__sun)
#define STR_INF "Infinity"
#define STR_NAN "NaN"
@@ -235,11 +233,7 @@
#define SHORT_STRING_LEN 16384 // special-case strings of up to this size
-#if PERL_VERSION >= 8
#define DECODE_WANTS_OCTETS(json) ((json)->flags & F_UTF8)
-#else
-#define DECODE_WANTS_OCTETS(json) (0)
-#endif
#define SB do {
#define SE } while (0)
@@ -1407,9 +1401,9 @@
# else
if (UNLIKELY(isinf(nv) || isnan(nv)))
# endif
- {
- goto is_inf_or_nan;
- }
+ {
+ goto is_inf_or_nan;
+ }
}
#endif
#ifdef USE_QUADMATH
@@ -1418,12 +1412,18 @@
(void)Gconvert (nv, NV_DIG, 0, enc->cur);
#endif
+#ifdef STR_INF4
+ if (UNLIKELY(strEQc(enc->cur, STR_INF)
+ || strEQc(enc->cur, STR_INF2)
+ || strEQc(enc->cur, STR_INF3)
+ || strEQc(enc->cur, STR_INF4)))
+#elif STR_INF2
+ if (UNLIKELY(strEQc(enc->cur, STR_INF)
+ || strEQc(enc->cur, STR_INF2)))
+#else
if (UNLIKELY(strEQc(enc->cur, STR_INF)))
- inf_or_nan = 1;
-#ifdef STR_INF2
- else if (UNLIKELY(strEQc(enc->cur, STR_INF2)))
- inf_or_nan = 1;
#endif
+ inf_or_nan = 1;
#if defined(__hpux)
else if (UNLIKELY(strEQc(enc->cur, STR_NEG_INF)))
inf_or_nan = 2;
@@ -1432,23 +1432,43 @@
#endif
else if
#ifdef HAVE_QNAN
+# ifdef STR_QNAN2
+ (UNLIKELY(strEQc(enc->cur, STR_NAN)
+ || strEQc(enc->cur, STR_QNAN)
+ || strEQc(enc->cur, STR_NAN2)
+ || strEQc(enc->cur, STR_QNAN2)))
+# else
(UNLIKELY(strEQc(enc->cur, STR_NAN)
|| strEQc(enc->cur, STR_QNAN)))
+# endif
#else
(UNLIKELY(strEQc(enc->cur, STR_NAN)))
#endif
inf_or_nan = 3;
else if (*enc->cur == '-') {
+#ifdef STR_INF4
+ if (UNLIKELY(strEQc(enc->cur+1, STR_INF)
+ || strEQc(enc->cur+1, STR_INF2)
+ || strEQc(enc->cur+1, STR_INF3)
+ || strEQc(enc->cur+1, STR_INF4)))
+#elif STR_INF2
+ if (UNLIKELY(strEQc(enc->cur+1, STR_INF)
+ || strEQc(enc->cur+1, STR_INF2)))
+#else
if (UNLIKELY(strEQc(enc->cur+1, STR_INF)))
- inf_or_nan = 2;
-#ifdef STR_INF2
- else if (UNLIKELY(strEQc(enc->cur+1, STR_INF2)))
- inf_or_nan = 2;
#endif
+ inf_or_nan = 2;
else if
#ifdef HAVE_QNAN
+# ifdef STR_QNAN2
+ (UNLIKELY(strEQc(enc->cur+1, STR_NAN)
+ || strEQc(enc->cur+1, STR_QNAN)
+ || strEQc(enc->cur+1, STR_NAN2)
+ || strEQc(enc->cur+1, STR_QNAN2)))
+# else
(UNLIKELY(strEQc(enc->cur+1, STR_NAN)
|| strEQc(enc->cur+1, STR_QNAN)))
+# endif
#else
(UNLIKELY(strEQc(enc->cur+1, STR_NAN)))
#endif
@@ -1477,7 +1497,8 @@
strncpy(enc->cur, "\"nan\"\0", 6);
}
else if (enc->json.infnan_mode != 2) {
- croak ("invalid stringify_infnan mode %c. Must be 0, 1, 2 or 3",
enc->json.infnan_mode);
+ croak ("invalid stringify_infnan mode %c. Must be 0, 1, 2 or 3",
+ enc->json.infnan_mode);
}
}
if (SvPOKp (sv) && !strEQ(enc->cur, SvPVX (sv))) {
@@ -2705,6 +2726,7 @@
HV *hv = newHV ();
int allow_squote = dec->json.flags & F_ALLOW_SQUOTE;
int allow_barekey = dec->json.flags & F_ALLOW_BAREKEY;
+ int relaxed = dec->json.flags & F_RELAXED;
char endstr = '"';
DEC_INC_DEPTH;
@@ -2786,6 +2808,10 @@
if (UNLIKELY(p - key > I32_MAX))
ERR ("Hash key too large");
#endif
+ if (!relaxed && UNLIKELY(hv_exists (hv, key, len))) {
+ ERR ("Duplicate keys not allowed");
+ }
+
dec->cur = p + 1;
decode_ws (dec); if (*p != ':') EXPECT_CH (':');
@@ -2847,7 +2873,7 @@
/* the next line creates a mortal sv each time it's called. */
/* might want to optimise this for common cases. */
- if (LIKELY(he))
+ if (LIKELY((long)he))
cb = hv_fetch_ent (dec->json.cb_sk_object, hv_iterkeysv (he), 0,
0);
if (cb)
@@ -3185,14 +3211,12 @@
}
}
-#if PERL_VERSION >= 8
if (LIKELY(!converted)) {
if (DECODE_WANTS_OCTETS (json))
sv_utf8_downgrade (string, 0);
else
sv_utf8_upgrade (string);
}
-#endif
/* should basically be a NOP but needed for 5.6 with undef */
if (!SvPOK(string))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/01_utf8.t
new/Cpanel-JSON-XS-3.0237/t/01_utf8.t
--- old/Cpanel-JSON-XS-3.0233/t/01_utf8.t 2017-03-29 11:51:37.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/t/01_utf8.t 2017-07-27 22:15:44.000000000
+0200
@@ -1,72 +1,76 @@
-use Test::More tests => 155;
+use Test::More tests => 162;
use utf8;
use Cpanel::JSON::XS;
+use warnings;
-is(Cpanel::JSON::XS->new->allow_nonref (1)->utf8 (1)->encode ("ü"),
"\"\xc3\xbc\"");
-is(Cpanel::JSON::XS->new->allow_nonref (1)->encode ("ü"), "\"ü\"");
+is(Cpanel::JSON::XS->new->allow_nonref->utf8->encode("ü"), "\"\xc3\xbc\"");
+is(Cpanel::JSON::XS->new->allow_nonref->encode("ü"), "\"ü\"");
-is(Cpanel::JSON::XS->new->allow_nonref (1)->ascii (1)->utf8 (1)->encode (chr
0x8000), '"\u8000"');
-is(Cpanel::JSON::XS->new->allow_nonref (1)->ascii (1)->utf8 (1)->pretty
(1)->encode (chr 0x10402), "\"\\ud801\\udc02\"\n");
+is(Cpanel::JSON::XS->new->allow_nonref->ascii->utf8->encode(chr 0x8000),
'"\u8000"');
+is(Cpanel::JSON::XS->new->allow_nonref->ascii->utf8->pretty->encode(chr
0x10402), "\"\\ud801\\udc02\"\n");
+
+ok not defined eval { Cpanel::JSON::XS->new->allow_nonref->utf8->decode('"ü"')
};
+like $@, qr/malformed UTF-8/;
+
+is(Cpanel::JSON::XS->new->allow_nonref->decode('"ü"'), "ü");
+is(Cpanel::JSON::XS->new->allow_nonref->decode('"\u00fc"'), "ü");
+
+ok not defined eval { decode_json ('"\ud801\udc02' . "\x{10204}\"", 1) };
+like $@, qr/Wide character/;
SKIP: {
skip "5.6", 1 if $] < 5.008;
- eval { Cpanel::JSON::XS->new->allow_nonref (1)->utf8 (1)->decode ('"ü"') };
- like $@, qr/malformed UTF-8/;
+ is(Cpanel::JSON::XS->new->allow_nonref->decode('"\ud801\udc02' .
"\x{10204}\""), "\x{10402}\x{10204}");
}
-is(Cpanel::JSON::XS->new->allow_nonref (1)->decode ('"ü"'), "ü");
-is(Cpanel::JSON::XS->new->allow_nonref (1)->decode ('"\u00fc"'), "ü");
-if ($] < 5.008) {
- eval { decode_json ('"\ud801\udc02' . "\x{10204}\"", 1) };
- like $@, qr/malformed UTF-8/;
-} else {
- is(Cpanel::JSON::XS->new->allow_nonref (1)->decode ('"\ud801\udc02' .
"\x{10204}\""), "\x{10402}\x{10204}");
-}
-is(Cpanel::JSON::XS->new->allow_nonref (1)->decode ('"\"\n\\\\\r\t\f\b"'),
"\"\012\\\015\011\014\010");
+is(Cpanel::JSON::XS->new->allow_nonref->decode('"\"\n\\\\\r\t\f\b"'),
"\"\012\\\015\011\014\010");
-my $love = $] < 5.008 ? "I \342\235\244 perl" : "I ❤ perl";
-is(Cpanel::JSON::XS->new->ascii->encode ([$love]),
- $] < 5.008 ? '["I \u00e2\u009d\u00a4 perl"]' : '["I \u2764 perl"]', 'utf8
enc ascii');
-is(Cpanel::JSON::XS->new->latin1->encode ([$love]),
- $] < 5.008 ? "[\"I \342\235\244 perl\"]" : '["I \u2764 perl"]', 'utf8
enc latin1');
+my $utf8_love = "I \342\235\244 perl";
+is(Cpanel::JSON::XS->new->ascii->encode([$utf8_love]), '["I \u00e2\u009d\u00a4
perl"]', 'utf8 enc ascii');
+is(Cpanel::JSON::XS->new->latin1->encode([$utf8_love]), "[\"I \342\235\244
perl\"]", 'utf8 enc latin1');
+is(Cpanel::JSON::XS->new->utf8->encode([$utf8_love]), "[\"I
\303\242\302\235\302\244 perl\"]", 'utf8 enc utf8');
+is(Cpanel::JSON::XS->new->binary->encode([$utf8_love]), '["I \xe2\x9d\xa4
perl"]', 'utf8 enc binary');
SKIP: {
- skip "5.6", 1 if $] < 5.008;
- require Encode;
- # [RT #84244] wrong complaint: JSON::XS double encodes to ["I ⤠perl"]
- # and with utf8 triple encodes it to ["I ⤠perl"]
- if ($Encode::VERSION < 2.40 or $Encode::VERSION >= 2.54) { # Encode stricter
check: Cannot decode string with wide characters
- # see also
http://stackoverflow.com/questions/12994100/perl-encode-pm-cannot-decode-string-with-wide-character
- $love = "I \342\235\244 perl";
- }
- my $s = Encode::decode_utf8($love); # User tries to double decode wide-char
to unicode with Encode
- is(Cpanel::JSON::XS->new->utf8->encode ([$s]), "[\"I \342\235\244 perl\"]",
'utf8 enc utf8 [RT #84244]');
+ skip "5.6", 4 if $] < 5.008;
+ my $unicode_love = "I ❤ perl";
+ is(Cpanel::JSON::XS->new->ascii->encode([$unicode_love]), '["I \u2764
perl"]', 'unicode enc ascii');
+ is(Cpanel::JSON::XS->new->latin1->encode([$unicode_love]), "[\"I \\u2764
perl\"]", 'unicode enc latin1');
+ is(Cpanel::JSON::XS->new->utf8->encode([$unicode_love]), "[\"I \342\235\244
perl\"]", 'unicode enc utf8');
+ is(Cpanel::JSON::XS->new->binary->encode([$unicode_love]), '["I \xe2\x9d\xa4
perl"]', 'unicode enc binary');
}
-is(Cpanel::JSON::XS->new->binary->encode ([$love]), '["I \xe2\x9d\xa4 perl"]',
'utf8 enc binary');
# TODO: test utf8 hash keys,
# test utf8 strings without any char > 0x80.
# warn on the 66 non-characters as in core
{
- my $w;
- require warnings;
- warnings->unimport($] < 5.014 ? 'utf8' : 'nonchar');
+ BEGIN { 'warnings'->import($] < 5.014 ? 'utf8' : 'nonchar') }
+ my $w = '';
$SIG{__WARN__} = sub { $w = shift };
my $d = Cpanel::JSON::XS->new->allow_nonref->decode('"\ufdd0"');
my $warn = $w;
- is ($d, "\x{fdd0}", substr($warn,0,31)."...");
+ {
+ no warnings 'utf8';
+ is ($d, "\x{fdd0}", substr($warn,0,31)."...");
+ }
like ($warn, qr/^Unicode non-character U\+FDD0 is/);
$w = '';
# higher planes
$d = Cpanel::JSON::XS->new->allow_nonref->decode('"\ud83f\udfff"');
$warn = $w;
- is ($d, "\x{1ffff}", substr($warn,0,31)."...");
+ {
+ no warnings 'utf8';
+ is ($d, "\x{1ffff}", substr($warn,0,31)."...");
+ }
like ($w, qr/^Unicode non-character U\+1FFFF is/);
$w = '';
$d = Cpanel::JSON::XS->new->allow_nonref->decode('"\ud87f\udffe"');
$warn = $w;
- is ($d, "\x{2fffe}", substr($warn,0,31)."...");
+ {
+ no warnings 'utf8';
+ is ($d, "\x{2fffe}", substr($warn,0,31)."...");
+ }
like ($w, qr/^Unicode non-character U\+2FFFE is/);
$w = '';
@@ -77,12 +81,15 @@
}
{
my $w;
- warnings->unimport($] < 5.014 ? 'utf8' : 'nonchar');
+ BEGIN { 'warnings'->import($] < 5.014 ? 'utf8' : 'nonchar') }
$SIG{__WARN__} = sub { $w = shift };
# no warning with relaxed
my $d = Cpanel::JSON::XS->new->allow_nonref->relaxed->decode('"\ufdd0"');
my $warn = $w;
- is ($d, "\x{fdd0}", "no warning with relaxed");
+ {
+ no warnings 'utf8';
+ is ($d, "\x{fdd0}", "no warning with relaxed");
+ }
is($w, undef);
}
@@ -144,9 +151,9 @@
{
# these are no multibyte codepoints, just raw utf8 bytes,
# so most of them work with 5.6 also.
- $^W = 1;
+ BEGIN { $^W = 1 }
+ BEGIN { 'warnings'->import($] < 5.014 ? 'utf8' : 'nonchar') }
my $w;
- warnings->import($] < 5.014 ? 'utf8' : 'nonchar');
$SIG{__WARN__} = sub { $w = shift };
for my $ill (@ill) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/03_types.t
new/Cpanel-JSON-XS-3.0237/t/03_types.t
--- old/Cpanel-JSON-XS-3.0233/t/03_types.t 2016-06-02 17:34:50.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/t/03_types.t 2017-07-27 22:15:44.000000000
+0200
@@ -22,7 +22,7 @@
ok ("$false" eq "0", "false: stringified $false eq 0");
#ok ("$false" eq "false", "false: stringified $false eq false");
#ok ("$true" eq "1", "true: stringified $true eq 1");
-ok ("$true" eq "true", "true: stringified $true");
+ok ("$true" eq "1", "true: stringified $true");
{
my $FH;
my $fn = "tmp_$$";
@@ -32,7 +32,7 @@
open $FH, "<", $fn;
my $s = <$FH>;
close $FH;
- ok ($s eq "0true\n", $s); # 11
+ ok ($s eq "01\n", $s); # 11
unlink $fn;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/117_numbers.t
new/Cpanel-JSON-XS-3.0237/t/117_numbers.t
--- old/Cpanel-JSON-XS-3.0233/t/117_numbers.t 2017-05-01 07:01:08.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/t/117_numbers.t 2017-07-28 11:20:18.000000000
+0200
@@ -16,6 +16,8 @@
my $json = Cpanel::JSON::XS->new->stringify_infnan;
my $have_qnan = ($^O eq 'MSWin32' || $^O eq 'aix') ? 1 : 0;
# TODO dec_osf
+# variants as in t/op/infnan.t
+my (@inf, @neg_inf, @nan, @neg_nan);
my ($inf, $nan) =
($^O eq 'MSWin32') ? ('1.#INF','1.#QNAN') :
($^O eq 'solaris') ? ('Infinity','NaN') :
@@ -30,22 +32,25 @@
($^O eq 'hpux') ? "---" :
"-".$inf;
-if ($^O eq 'MSWin32'
- and $Config{ccflags} =~ /-D__USE_MINGW_ANSI_STDIO/
- and $Config{uselongdouble})
-{
+if ($^O eq 'MSWin32' and $Config{ccflags} =~ /-D__USE_MINGW_ANSI_STDIO/) {
$have_qnan = 0;
($inf, $neg_inf, $nan, $neg_nan) = ('inf','-inf','nan','-nan');
+ @inf = ($inf);
+ @neg_inf = ($neg_inf);
+ @nan = ($nan);
+ @neg_nan = ($neg_nan);
}
-# Windows changed it with MSVC 14.0 and the ucrtd.dll runtime
-diag "ccversion = $Config{ccversion}" if $^O eq 'MSWin32' and
$Config{ccversion};
-if ($^O eq 'MSWin32' and $Config{ccversion}) {
- my $mscver = $Config{ccversion}; # "19.00.24215.1" for 14.0 (VC++ 2015)
- $mscver =~ s/^(\d+\.\d\+).(\d+)\.(\d+)/$1$2$3/;
- if ($mscver >= 19.0) {
- $have_qnan = 0;
- ($inf, $neg_inf, $nan, $neg_nan) = ('inf','-inf','nan','-nan(ind)');
- }
+elsif ($^O eq 'MSWin32') { # new ucrtd.dll
+ ($inf, $neg_inf, $nan, $neg_nan) = ('inf','-inf','nan','-nan');
+ @inf = ('1.#INF', 'inf');
+ @neg_inf = ('-1.#INF', '-inf');
+ @nan = ('1.#QNAN', 'nan');
+ @neg_nan = ('-1.#IND', '-nan', '-nan(ind)');
+} else {
+ @inf = ($inf);
+ @neg_inf = ($neg_inf);
+ @nan = ($nan);
+ @neg_nan = ($neg_nan);
}
# newlib and glibc 2.5 have no -nan support, just nan. The BSD's neither, but
they might
# come up with it lateron, as darwin did.
@@ -53,27 +58,45 @@
# $neg_nan = $nan;
#}
+sub match {
+ my ($r, $tmpl, $desc, @list) = @_;
+ my $match = shift @list;
+ my $m = $tmpl;
+ $m =~ s/__XX__/$match/;
+ $match = $m;
+ for my $m1 (@list) { # at least one must match
+ $m = $tmpl;
+ $m =~ s/__XX__/$m1/;
+ diag "try $m eq $r" if $ENV{TEST_VERBOSE};
+ $match = $m if $r eq $m;
+ }
+ is $r, $match, $desc;
+}
+
my $r = $json->encode([9**9**9]);
$r =~ s/\.0$// if $^O eq 'MSWin32';
-is $r, "[\"$inf\"]", "inf -> \"inf\" stringify_infnan(1)";
+match($r, "[\"__XX__\"]", "inf -> \"inf\" stringify_infnan(1)", @inf);
+
$r = $json->encode([-9**9**9]);
$r =~ s/\.0$// if $^O eq 'MSWin32';
-is $r, "[\"$neg_inf\"]", "-inf -> \"-inf\"";
+match($r, "[\"__XX__\"]", "-inf -> \"-inf\"", @neg_inf);
+
# The concept of negative nan is not portable and varies too much.
# Windows even emits neg_nan for the first test sometimes. HP-UX has all tests
reverse.
-like $json->encode([-sin(9**9**9)]), qr/\[\"(\Q$neg_nan\E|\Q$nan\E)\"\]/,
"nan -> \"nan\"";
-like $json->encode([sin(9**9**9)]), qr/\[\"(\Q$neg_nan\E|\Q$nan\E)\"\]/,
"-nan -> \"-nan\"";
-like $json->encode([9**9**9/9**9**9]), qr/\[\"(\Q$neg_nan\E|\Q$nan\E)\"\]/,
"-nan -> \"-nan\"";
+match($json->encode([-sin(9**9**9)]), "[\"__XX__\"]", "nan -> \"nan\"",
@nan, @neg_nan);
+match($json->encode([sin(9**9**9)]), "[\"__XX__\"]", "-nan -> \"-nan\"",
@nan, @neg_nan);
+match($json->encode([9**9**9/9**9**9]), "[\"__XX__\"]", "-nan -> \"-nan\"",
@nan, @neg_nan);
# infnan_mode = 2: # inf/nan values, as in JSON::XS and older releases.
$json = Cpanel::JSON::XS->new->stringify_infnan(2);
-is $json->encode([9**9**9]), "[$inf]", "inf stringify_infnan(2)";
-is $json->encode([-9**9**9]), "[$neg_inf]", "-inf";
-like $json->encode([-sin(9**9**9)]), qr/\[(\Q$neg_nan\E|\Q$nan\E)\]/, "nan";
-like $json->encode([sin(9**9**9)]), qr/\[(\Q$neg_nan\E|\Q$nan\E)\]/, "-nan";
-like $json->encode([9**9**9/9**9**9]), qr/\[(\Q$neg_nan\E|\Q$nan\E)\]/, "-nan";
+match($json->encode([9**9**9]), "[__XX__]", "inf stringify_infnan(2)", @inf);
+match($json->encode([-9**9**9]), "[__XX__]", "-inf", @neg_inf);
+match($json->encode([-sin(9**9**9)]), "[__XX__]", "nan", @nan, @neg_nan);
+match($json->encode([sin(9**9**9)]), "[__XX__]", "-nan", @nan, @neg_nan);
+match($json->encode([9**9**9/9**9**9]), "[__XX__]", "-nan", @nan, @neg_nan);
-# infnan_mode = 3: # inf/nan values unified to inf/-inf/nan strings. no
qnan/snan/negative nan
+# infnan_mode = 3:
+# inf/nan values unified to inf/-inf/nan strings. no qnan/snan/negative nan
$json = Cpanel::JSON::XS->new->stringify_infnan(3);
is $json->encode([9**9**9]), '["inf"]', "inf stringify_infnan(3)";
is $json->encode([-9**9**9]), '["-inf"]', "-inf";
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/25_boolean.t
new/Cpanel-JSON-XS-3.0237/t/25_boolean.t
--- old/Cpanel-JSON-XS-3.0233/t/25_boolean.t 2015-12-02 23:45:39.000000000
+0100
+++ new/Cpanel-JSON-XS-3.0237/t/25_boolean.t 2017-07-27 22:15:44.000000000
+0200
@@ -1,19 +1,16 @@
use strict;
-use Test::More tests => 17;
+use Test::More tests => 32;
use Cpanel::JSON::XS ();
my $booltrue = q({"is_true":true});
my $boolfalse = q({"is_false":false});
-# since 5.16 yes/no is !0/!1, but for earlier perls we need to use a BoolSV
-my $a = 0;
-my $yes = do{$a==0}; # < 5.16 !0 is not sv_yes
-my $no = do{$a==1}; # < 5.16 !1 is not sv_no
-my $yesno = [ $yes, $no ]; # native yes/no. YAML::XS compatible
my $truefalse = "[true,false]";
my $cjson = Cpanel::JSON::XS->new;
my $true = Cpanel::JSON::XS::true;
my $false = Cpanel::JSON::XS::false;
+my $nonref_cjson = Cpanel::JSON::XS->new->allow_nonref;
+
# from JSON::MaybeXS
my $data = $cjson->decode('{"foo": true, "bar": false, "baz": 1}');
ok($cjson->is_bool($data->{foo}), 'true decodes to a bool')
@@ -37,10 +34,43 @@
is( $cjson->encode( [ $true, $false] ),
$truefalse );
-TODO: {
- local $TODO = 'GH #39';
- is( $cjson->encode( $yesno ), $truefalse, "map yes/no to [true,false]");
+# GH #39
+# perl block which returns sv_no or sv_yes
+is( $nonref_cjson->encode( do{(my $a=0)==1} ), "false", "map do{(my
\$a)=0)==1} to false");
+is( $nonref_cjson->encode( do{(my $a=0)==1} ), "false", "map do{(my
\$a)=0)==1} to false");
+is( $nonref_cjson->encode( do{(my $a=1)==1} ), "true", "map do{(my \$a)=1)==1}
to true");
+is( $nonref_cjson->encode( do{(my $a=1)==1} ), "true", "map do{(my \$a)=1)==1}
to true");
+
+# GH #39
+# XS function UNIVERSAL::isa returns sv_no or sv_yes
+is( $nonref_cjson->encode( UNIVERSAL::isa('0', '1') ), "false", "map
UNIVERSAL::isa('0', '1') to false");
+is( $nonref_cjson->encode( UNIVERSAL::isa('0', '1') ), "false", "map
UNIVERSAL::isa('0', '1') to false");
+is( $nonref_cjson->encode( UNIVERSAL::isa('UNIVERSAL', 'UNIVERSAL') ), "true",
"map UNIVERSAL::isa('UNIVERSAL', 'UNIVERSAL') to true");
+is( $nonref_cjson->encode( UNIVERSAL::isa('UNIVERSAL', 'UNIVERSAL') ), "true",
"map UNIVERSAL::isa('UNIVERSAL', 'UNIVERSAL') to true");
+
+# GH #39
+# XS function utf8::is_utf8 returns sv_no or sv_yes
+SKIP: {
+ skip 'Perl 5.8 is needed for boolean tests based on
utf8::upgrade()+utf8::is_utf8()', 4 if $] < 5.008;
+ is( $nonref_cjson->encode( do{utf8::is_utf8(my $a)} ), "false", "map
do{utf8::is_utf8(my \$a)} to false");
+ is( $nonref_cjson->encode( do{utf8::is_utf8(my $a)} ), "false", "map
do{utf8::is_utf8(my \$a)} to false");
+ my $utf8 = '';
+ utf8::upgrade($utf8);
+ is( $nonref_cjson->encode( do{utf8::is_utf8($utf8)} ), "true", "map
do{utf8::is_utf8(\$utf8)} to true");
+ is( $nonref_cjson->encode( do{utf8::is_utf8($utf8)} ), "true", "map
do{utf8::is_utf8(\$utf8)} to true");
+}
+
+# GH #39
+# perl expression which evaluates to sv_no or sv_yes
+SKIP: {
+ # implemented in 5.16 but broken, works since 5.20
+ skip 'Perl 5.20 is needed for boolean tests based on !1 and !0', 4 if $] <
5.020;
+ is( $nonref_cjson->encode( !1 ), "false", "map !1 to false");
+ is( $nonref_cjson->encode( !1 ), "false", "map !1 to false");
+ is( $nonref_cjson->encode( !0 ), "true", "map !0 to true");
+ is( $nonref_cjson->encode( !0 ), "true", "map !0 to true");
}
+
$js = $cjson->decode( $truefalse );
ok ($js->[0] == $true, "decode true to yes");
ok ($js->[1] == $false, "decode false to no");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/26_duplicate.t
new/Cpanel-JSON-XS-3.0237/t/26_duplicate.t
--- old/Cpanel-JSON-XS-3.0233/t/26_duplicate.t 1970-01-01 01:00:00.000000000
+0100
+++ new/Cpanel-JSON-XS-3.0237/t/26_duplicate.t 2017-07-27 22:15:44.000000000
+0200
@@ -0,0 +1,13 @@
+use Test::More tests => 4;
+use Cpanel::JSON::XS;
+
+my $json = Cpanel::JSON::XS->new;
+
+# disallow dupkeys:
+ok (!eval { $json->decode ('{"a":"b","a":"c"}') }); #
y_object_duplicated_key.json
+ok (!eval { $json->decode ('{"a":"b","a":"b"}') }); #
y_object_duplicated_key_and_value.json
+
+$json->relaxed;
+is (encode_json $json->decode ('{"a":"b","a":"c"}'), '{"a":"c"}'); #
y_object_duplicated_key.json
+is (encode_json $json->decode ('{"a":"b","a":"b"}'), '{"a":"b"}'); #
y_object_duplicated_key_and_value.json
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/30_jsonspec.t
new/Cpanel-JSON-XS-3.0237/t/30_jsonspec.t
--- old/Cpanel-JSON-XS-3.0233/t/30_jsonspec.t 2017-05-01 15:08:59.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/t/30_jsonspec.t 2017-07-27 22:15:44.000000000
+0200
@@ -14,7 +14,7 @@
# i_string_unicode_*_nonchar ["\uDBFF\uDFFE"] (add warning as in core)
# i_string_not_in_unicode_range Code point 0x13FFFF is not Unicode
UTF8_DISALLOW_SUPER
# y_string_utf16, y_string_utf16be, y_string_utf32, y_string_utf32be fixed
with 3.0222
-my %todo = {};
+my %todo;
$todo{'y_string_nonCharacterInUTF-8_U+FFFF'}++ if $] < 5.013;
$todo{'n_string_UTF8_surrogate_U+D800'}++ if $] >= 5.012;
if ($] < 5.008) {
@@ -54,6 +54,8 @@
i_string_UTF-16_invalid_surrogate
i_string_UTF-8_invalid_sequence
i_string_not_in_unicode_range
+ y_object_duplicated_key
+ y_object_duplicated_key_and_value
);
# should parse and return undef:
my %i_empty = map{$_ => 1}
@@ -166,7 +168,11 @@
close $fh;
}
my ($base) = ($f =~ m|test_parsing/(.*)\.json|);
- if ($base =~ /^y_/) {
+ # This is arguably a specification bug. it should error on default
+ if ($base =~ /y_object_duplicated_key/) {
+ n_error($s, $base);
+ }
+ elsif ($base =~ /^y_/) {
y_pass($s, $base);
}
elsif ($base =~ /^n_/) {
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/96_mojo.t
new/Cpanel-JSON-XS-3.0237/t/96_mojo.t
--- old/Cpanel-JSON-XS-3.0233/t/96_mojo.t 2016-06-06 15:26:10.000000000
+0200
+++ new/Cpanel-JSON-XS-3.0237/t/96_mojo.t 2017-07-27 22:15:44.000000000
+0200
@@ -38,10 +38,15 @@
# fragile
ok( $js->[0] eq '' or $js->[0] == 0 or !$js->[0], 'can decode Mojo false' );
is( $js->[1], 1, 'can decode Mojo true' );
-TODO: {
- # Note this is fragile. it depends on the internal representation of
booleans.
- # It can also be ['0', '1']
- local $TODO = 'fragile';
+# Note this is fragile. it depends on the internal representation of booleans.
+# It can also be ['0', '1']
+if ($js->[0] eq '') {
is_deeply( $js, ['', 1], 'can decode Mojo booleans' )
or diag( $mj, $js );
+} else {
+ TODO: {
+ local $TODO = 'fragile false => "0"';
+ is_deeply( $js, ['', 1], 'can decode Mojo booleans' )
+ or diag( $mj, $js );
+ }
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/appveyor-test.bat
new/Cpanel-JSON-XS-3.0237/t/appveyor-test.bat
--- old/Cpanel-JSON-XS-3.0233/t/appveyor-test.bat 2017-05-01
14:18:48.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/t/appveyor-test.bat 2017-07-27
22:15:44.000000000 +0200
@@ -1,7 +1,7 @@
@echo off
-rem Test::MinimumVersion
-set REQS=Pod::Text Time::Piece common::sense Mojo::JSON JSON Test::LeakTrace
Test::CPAN::Meta Test::Pod Test::Pod::Coverage
+rem Test::MinimumVersion JSON
+set REQS=Pod::Text Time::Piece common::sense Mojo::JSON Test::LeakTrace
Test::CPAN::Meta Test::Pod Test::Pod::Coverage
set PERL_MM_USE_DEFAULT=1
if not "%PLATFORM%" == "x64" set WIN64=undef
@@ -11,14 +11,15 @@
:gcc
set
PATH=C:\strawberry\perl\bin;C:\strawberry\perl\site\bin;C:\strawberry\c\bin;%PATH%
-rem echo cpan -T %REQS%
-rem cpan -T %REQS%
+echo cpan -T %REQS%
+call cpan -T %REQS% || exit /b 1
echo perl Makefile.PL
-perl Makefile.PL
-echo dmake
-dmake
-echo dmake test
-dmake test
+perl Makefile.PL || exit /b 1
+rem strawberry switched with 5.26 from dmake to gmake
+echo $Config{make}
+perl -MConfig -e "system({$Config{make}} $Config{make}); exit(($? < 0 || $? &
127) ? 1 : ($? >> 8));" || exit /b 1
+echo $Config{make} test
+perl -MConfig -e "system({$Config{make}} $Config{make}, 'test'); exit(($? < 0
|| $? & 127) ? 1 : ($? >> 8));" || exit /b 1
exit /b
@@ -26,11 +27,15 @@
if "%PLATFORM%" == "x64" set PLATFORM=amd64
rem 14 deviates from cperl with linker errors for the libc runtime
set MSVC_VERSION=12
-call "C:\Program Files (x86)\Microsoft Visual Studio
%MSVC_VERSION%.0\VC\vcvarsall.bat" %PLATFORM%
+call "C:\Program Files (x86)\Microsoft Visual Studio
%MSVC_VERSION%.0\VC\vcvarsall.bat" %PLATFORM% || exit /b 1
set PATH=C:\cperl\bin;C:\cperl\site\bin;%PATH%
-cperl -S cpan -T %REQS%
-cperl Makefile.PL
-nmake
-nmake test
+echo cperl -S cpan -T %REQS%
+cperl -S cpan -T %REQS% || exit /b 1
+echo cperl Makefile.PL
+cperl Makefile.PL || exit /b 1
+echo nmake
+nmake || exit /b 1
+echo nmake test
+nmake test || exit /b 1
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-3.0233/t/z_perl_minimum_version.t
new/Cpanel-JSON-XS-3.0237/t/z_perl_minimum_version.t
--- old/Cpanel-JSON-XS-3.0233/t/z_perl_minimum_version.t 2015-10-23
11:00:11.000000000 +0200
+++ new/Cpanel-JSON-XS-3.0237/t/z_perl_minimum_version.t 2017-07-27
22:15:44.000000000 +0200
@@ -9,7 +9,7 @@
my @MODULES = (
'Perl::MinimumVersion 1.20',
- 'Test::MinimumVersion 0.008',
+ 'Test::MinimumVersion 0.101082',
);
# Don't run tests during end-user installs