Hello community,
here is the log from the commit of package perl-Cpanel-JSON-XS for
openSUSE:Factory checked in at 2019-03-29 20:42:56
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS (Old)
and /work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new.25356 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Cpanel-JSON-XS"
Fri Mar 29 20:42:56 2019 rev:18 rq:689724 version:4.11
Changes:
--------
--- /work/SRC/openSUSE:Factory/perl-Cpanel-JSON-XS/perl-Cpanel-JSON-XS.changes
2019-03-22 15:08:54.185414808 +0100
+++
/work/SRC/openSUSE:Factory/.perl-Cpanel-JSON-XS.new.25356/perl-Cpanel-JSON-XS.changes
2019-03-29 20:42:58.674677667 +0100
@@ -1,0 +2,11 @@
+Wed Mar 27 06:07:16 UTC 2019 - Stephan Kulow <[email protected]>
+
+- updated to 4.11
+ see /usr/share/doc/packages/perl-Cpanel-JSON-XS/Changes
+
+ 4.11 2019-03-26 (rurban)
+ - Fix unicode strings with BOM corrupt ->utf8 state (#125)
+ The BOM encoding effects only its very own decode call,
+ not its object.
+
+-------------------------------------------------------------------
Old:
----
Cpanel-JSON-XS-4.10.tar.gz
New:
----
Cpanel-JSON-XS-4.11.tar.gz
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ perl-Cpanel-JSON-XS.spec ++++++
--- /var/tmp/diff_new_pack.aIGRdK/_old 2019-03-29 20:42:59.150677652 +0100
+++ /var/tmp/diff_new_pack.aIGRdK/_new 2019-03-29 20:42:59.150677652 +0100
@@ -17,7 +17,7 @@
Name: perl-Cpanel-JSON-XS
-Version: 4.10
+Version: 4.11
Release: 0
%define cpan_name Cpanel-JSON-XS
Summary: CPanel fork of JSON::XS, fast and correct serializing
++++++ Cpanel-JSON-XS-4.10.tar.gz -> Cpanel-JSON-XS-4.11.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/Changes
new/Cpanel-JSON-XS-4.11/Changes
--- old/Cpanel-JSON-XS-4.10/Changes 2019-03-18 08:47:57.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/Changes 2019-03-26 17:45:45.000000000 +0100
@@ -2,6 +2,11 @@
TODO: http://stevehanov.ca/blog/index.php?id=104 compression
+4.11 2019-03-26 (rurban)
+ - Fix unicode strings with BOM corrupt ->utf8 state (#125)
+ The BOM encoding effects only its very own decode call,
+ not its object.
+
4.10 2019-03-18 (rurban)
- Fix incr_text refcounts (#123)
- Add incr_rest testcase (#123)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/META.json
new/Cpanel-JSON-XS-4.11/META.json
--- old/Cpanel-JSON-XS-4.10/META.json 2019-03-18 08:49:05.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/META.json 2019-03-26 17:46:03.000000000 +0100
@@ -4,7 +4,7 @@
"Reini Urban <[email protected]>"
],
"dynamic_config" : 1,
- "generated_by" : "ExtUtils::MakeMaker version 8.3506, CPAN::Meta::Converter
version 2.150010",
+ "generated_by" : "ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter
version 2.150010",
"license" : [
"perl_5"
],
@@ -48,30 +48,32 @@
"url" : "https://github.com/rurban/Cpanel-JSON-XS"
}
},
- "version" : "4.10",
+ "version" : "4.11",
"x_contributors" : [
"Ashley Willis <[email protected]>",
- "Daniel Dragan <[email protected]>",
+ "Chip Salzenberg <[email protected]>",
+ "Christopher J. Madsen <[email protected]>",
"Colin Kuskie <[email protected]>",
+ "Daniel Dragan <[email protected]>",
"David Golden <[email protected]>",
"David Steinbrunner <[email protected]>",
+ "E. Choroba <[email protected]>",
"Gianni Ceccarelli <[email protected]>",
"Gilmar Santos Jr <[email protected]>",
"Graham Knop <[email protected]>",
- "Chip Salzenberg <[email protected]>",
- "Christopher J. Madsen <[email protected]>",
+ "James Rouzier <[email protected]>",
"J. Nick Koston <[email protected]>",
"Karen Etheridge <[email protected]>",
"Lubomir Rintel <[email protected]>",
- "Marc Lehmann <[email protected]>",
+ "Lukas Mai <[email protected]>",
"Matthew Horsfall <[email protected]>",
"Michael G. Schwern <[email protected]>",
"Pali <[email protected]>",
"Patrick Cronin <[email protected]>",
"Quim Rovira <[email protected]>",
- "Reini Urban <[email protected]>",
"Sergey Aleynikov <[email protected]>",
- "Syohei Yoshida <[email protected]>"
+ "Syohei Yoshida <[email protected]>",
+ "tevfik1903 <[email protected]>"
],
- "x_serialization_backend" : "JSON::PP version 2.97001_04"
+ "x_serialization_backend" : "JSON::PP version 2.97001"
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/META.yml
new/Cpanel-JSON-XS-4.11/META.yml
--- old/Cpanel-JSON-XS-4.10/META.yml 2019-03-18 08:49:05.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/META.yml 2019-03-26 17:46:03.000000000 +0100
@@ -7,7 +7,7 @@
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
-generated_by: 'ExtUtils::MakeMaker version 8.3506, CPAN::Meta::Converter
version 2.150010'
+generated_by: 'ExtUtils::MakeMaker version 7.34, CPAN::Meta::Converter version
2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -23,28 +23,30 @@
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.10'
+version: '4.11'
x_contributors:
- 'Ashley Willis <[email protected]>'
- - 'Daniel Dragan <[email protected]>'
+ - 'Chip Salzenberg <[email protected]>'
+ - 'Christopher J. Madsen <[email protected]>'
- 'Colin Kuskie <[email protected]>'
+ - 'Daniel Dragan <[email protected]>'
- 'David Golden <[email protected]>'
- 'David Steinbrunner <[email protected]>'
+ - 'E. Choroba <[email protected]>'
- 'Gianni Ceccarelli <[email protected]>'
- 'Gilmar Santos Jr <[email protected]>'
- 'Graham Knop <[email protected]>'
- - 'Chip Salzenberg <[email protected]>'
- - 'Christopher J. Madsen <[email protected]>'
+ - 'James Rouzier <[email protected]>'
- 'J. Nick Koston <[email protected]>'
- 'Karen Etheridge <[email protected]>'
- 'Lubomir Rintel <[email protected]>'
- - 'Marc Lehmann <[email protected]>'
+ - 'Lukas Mai <[email protected]>'
- 'Matthew Horsfall <[email protected]>'
- 'Michael G. Schwern <[email protected]>'
- 'Pali <[email protected]>'
- 'Patrick Cronin <[email protected]>'
- 'Quim Rovira <[email protected]>'
- - 'Reini Urban <[email protected]>'
- 'Sergey Aleynikov <[email protected]>'
- 'Syohei Yoshida <[email protected]>'
+ - 'tevfik1903 <[email protected]>'
x_serialization_backend: 'CPAN::Meta::YAML version 0.018'
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/Makefile.PL
new/Cpanel-JSON-XS-4.11/Makefile.PL
--- old/Cpanel-JSON-XS-4.10/Makefile.PL 2018-08-22 18:42:09.000000000 +0200
+++ new/Cpanel-JSON-XS-4.11/Makefile.PL 2019-03-26 17:45:45.000000000 +0100
@@ -98,27 +98,29 @@
},
x_contributors => [
'Ashley Willis <[email protected]>',
- 'Daniel Dragan <[email protected]>',
+ 'Chip Salzenberg <[email protected]>',
+ 'Christopher J. Madsen <[email protected]>',
'Colin Kuskie <[email protected]>',
+ 'Daniel Dragan <[email protected]>',
'David Golden <[email protected]>',
'David Steinbrunner <[email protected]>',
+ 'E. Choroba <[email protected]>',
'Gianni Ceccarelli <[email protected]>',
'Gilmar Santos Jr <[email protected]>',
'Graham Knop <[email protected]>',
- 'Chip Salzenberg <[email protected]>',
- 'Christopher J. Madsen <[email protected]>',
+ 'James Rouzier <[email protected]>',
'J. Nick Koston <[email protected]>',
'Karen Etheridge <[email protected]>',
'Lubomir Rintel <[email protected]>',
- 'Marc Lehmann <[email protected]>',
+ 'Lukas Mai <[email protected]>',
'Matthew Horsfall <[email protected]>',
'Michael G. Schwern <[email protected]>',
'Pali <[email protected]>',
'Patrick Cronin <[email protected]>',
'Quim Rovira <[email protected]>',
- 'Reini Urban <[email protected]>',
'Sergey Aleynikov <[email protected]>',
'Syohei Yoshida <[email protected]>',
+ 'tevfik1903 <[email protected]>',
],
}
) : ()),
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/README
new/Cpanel-JSON-XS-4.11/README
--- old/Cpanel-JSON-XS-4.10/README 2019-03-18 08:49:08.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/README 2019-03-26 17:46:04.000000000 +0100
@@ -105,7 +105,7 @@
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.
+ - numbers ending with .0 stray 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
@@ -1206,6 +1206,9 @@
Detect all unicode Byte Order Marks on decode. Which are UTF-8,
UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE.
+ The BOM encoding is set only for one specific decode call, it does not
+ change the state of the JSON object.
+
Warning: With perls older than 5.20 you need load the Encode module
before loading a multibyte BOM, i.e. >= UTF-16. Otherwise an error is
thrown. This is an implementation limitation and might get fixed later.
@@ -2019,14 +2022,14 @@
be fixed swiftly, though.
Since the JSON::XS author refuses to use a public bugtracker and prefers
- private emails, we've setup a tracker at RT, so you might want to report
- any issues twice. Once in private to MLEHMANN to be fixed in JSON::XS
- and one to our the public tracker. Issues fixed by JSON::XS with a new
- release will also be backported to Cpanel::JSON::XS and 5.6.2, as long
- as cPanel relies on 5.6.2 and Cpanel::JSON::XS as our serializer of
- choice.
+ private emails, we use the tracker at github, so you might want to
+ report any issues twice. Once in private to MLEHMANN to be fixed in
+ JSON::XS and one to our the public tracker. Issues fixed by JSON::XS
+ with a new release will also be backported to Cpanel::JSON::XS and
+ 5.6.2, as long as cPanel relies on 5.6.2 and Cpanel::JSON::XS as our
+ serializer of choice.
- <https://rt.cpan.org/Public/Dist/Display.html?Queue=Cpanel-JSON-XS>
+ <https://github.com/rurban/Cpanel-JSON-XS/issues>
LICENSE
This module is available under the same licences as perl, the Artistic
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/SIGNATURE
new/Cpanel-JSON-XS-4.11/SIGNATURE
--- old/Cpanel-JSON-XS-4.10/SIGNATURE 2019-03-18 08:49:08.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/SIGNATURE 2019-03-26 17:46:04.000000000 +0100
@@ -12,24 +12,24 @@
not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA512
+Hash: SHA256
SHA256 0abb585f231403618cae65047cfb3910d018ec83951b2bc14dcef5cbc77d1151
.appveyor.yml
SHA256 797abf38891d61e631374ccba78b2a8a707901227012c59372f5a9b2bc867188
.travis.yml
SHA256 8de3540a3cd7ecc9a9dcb48975fe852c082fe17d4462f87bb72aa7cc47f083ad COPYING
-SHA256 d0fb74795b89f0f60cd24c12a94bfbc8e3d2a56fad32d7091b91bce21316ab72 Changes
+SHA256 194bdaafc23d7c8590d6a79fa97313e53ac77aee75b0596a8090653677f4450a Changes
SHA256 04d51042e2091c8c1f22252efa7e11322d2f6c4dc60c5145aec77e2969f506c8
MANIFEST
-SHA256 27346ea551ba6d65ce3b6d2f740bbc1b18cfc4100ca76d9fefb721d01d1c8e20
META.json
-SHA256 c5c808a568fa2ff95e873833320b24a9a8c92e7d644482b9b3b3306ab3761326
META.yml
-SHA256 d718ee16b2c401c39ce7e2aa2262d4950498879764e060506ed8d667d0a4b798
Makefile.PL
-SHA256 599983808ff085fb2e2ec6021e56bac1ffddf315cefb1450e5d58e7687d793a9 README
-SHA256 377a81926fccc1a7a9a8a35ee2988cbcd6239b8bab741c45696ab8c981b56a68 XS.pm
-SHA256 ca5cb63280ef9427d62f39511917690389700af4d4524f79513738befbc37135 XS.xs
+SHA256 29bb695600128a2b4e927f9bf58be012ab01f5456dc79d9ced2a026467a0a0bc
META.json
+SHA256 75d7364940bfec9c29f0fee8e91f43d3cf72f7797c46752676dce75565d0ff7d
META.yml
+SHA256 0161feeade3462743c01c6f1ed7d0d3d2ed0ab2dfe12e77b3b72370df52f636f
Makefile.PL
+SHA256 b1cc0c54dd2c73af4788751d29ff2106a05462f75fa533d823f24eadbe8ce5bd README
+SHA256 a95c7358e91f96db3af82280ff64c9ce65313ebf156b7c4095d03f8f429f53d2 XS.pm
+SHA256 4302048fb353ea21ef4394b795f6bc3ce7f1b45db525a25a0cdbde5e46f29369 XS.xs
SHA256 c95e4b970183cbd6d1ec9c88c37a80f12bd2b66ed6be3c008ffd578d2f622c01
XS/Boolean.pm
SHA256 f9a40fece0783df5c1d1d3d6f2586e61689b0445dcf10bba2916553c29d5f490
XS/Type.pm
SHA256 2f34a530b7ce981b0df9aacd2b6944ccf74c4a7f8bb49fde57b342663e7feb26
bin/cpanel_json_xs
SHA256 0d188abe82c2270e7bc5fc21de1d8210bfc52118a834b22592781bb2879a6065
eg/bench
-SHA256 d9bb17ea9bb54f1062d44f52aa88180737fde99b3e4258df9777bbcdc9a63ddd
ppport.h
+SHA256 3290077eba2e57ff1d2bf46c2a7d34a3b9c7f9b24fe517a3943430f5720da95f
ppport.h
SHA256 8bd5ef4d15ed3a9b2e641cc04549d6eed1532c86bba907e2b035d80c8dd5ac2c
t/00_load.t
SHA256 07c0d02dcabd1d0996e6ab852df867fe7f91d551579832760262f586b56a1808
t/01_utf8.t
SHA256 d2ec342bd9183411689ae9fee51b4e6730f6e5dce95f49cb59b4b38237337f1e
t/02_error.t
@@ -74,7 +74,7 @@
SHA256 b35b52310a4c3edfcb2653f681aa7a42712cf93a0a8d66729544996bdcf9ce06
t/25_boolean.t
SHA256 25d388275acde51b3d768b80c7a4b03d47988cc3919c81aa71b657250b5d4099
t/26_duplicate.t
SHA256 03a2061b4742ea591961a4ce7403feac91998c0909dbde982c465ce3d2c39706
t/30_jsonspec.t
-SHA256 f31d07044b924b28a1329f9eac213ad903ec4b8bb6eda095a609cb8c87870439
t/31_bom.t
+SHA256 cf2181a691d5e1862d71e4e902928a0d899b9671e3633584efa8ae3f5cc0d174
t/31_bom.t
SHA256 59c743137453c8c4e9e785a15dcd057b0209d5ce160d683d7ab416dc37a92b6d
t/52_object.t
SHA256 3b9ce402e2d0cae8a525df4beca05f2656ba5cf02b074d02fd690fe97773d2d7
t/53_readonly.t
SHA256 949e22de3e54ca7624cea2610a26c0b4697040ea5113fdca3b77564d90f82e24
t/54_stringify.t
@@ -437,12 +437,12 @@
SHA256 aca6f846869ab2e4881e807739086e1535b1438bd0e23d7a021360742736a6a9
xt/pod.t
-----BEGIN PGP SIGNATURE-----
-iQEzBAEBCgAdFiEEKJWogdNCcPq/6PdHtPYzOeZdZBQFAlyPTXIACgkQtPYzOeZd
-ZBQ2Awf/ZxPvzIhafA9258hDm/ocKiMtJqrmqOkkVpYCfi5537XYWwj0zgkWHdva
-Pi/ADvePTy8nPRGb/Ko9tiZS/bku6RQ7dQbWuZqjCHYOOO5GC9WZSTFFingxSkRU
-x2HE5GtfKWEqQ7n2PYNr+fFxXxa2Nvu3yAsCdr+1mVu0wu012kmee4wVm8AcrLLU
-8CjV1gEPAlvNVUEeG9FF4MlfyrynETnzVgE2E5a5wUxFubZTL/tQ8qeWaOdmmoRf
-hDR3xgtB3n5k9yZ2QfMz4S/IjjEo+FX9+pehqwcm3jlh6qEplJbrR/xkyyF9SGae
-TatfnmOPFtqvq5bGcGowHVBECOe3Ww==
-=L7NV
+iQEzBAEBCAAdFiEEKJWogdNCcPq/6PdHtPYzOeZdZBQFAlyaV0sACgkQtPYzOeZd
+ZBQ6OggAqdANm+uvP0K7E6lCDNM6ZrPy00fowN5s3Vjkv+nya8BRMlDx4RMhNoRc
+Qqxm+dMq99zPEmXVhwdgFSmkvPAXDYcXi2byYCapkbYM1diULOn6jWgYSBb3+1P6
+i37ZMMfCywy/6CHQbz/oH+yJG3/v0PiwTl4OvMV+ODKIuUhQALoeBI5Oo05HSya8
++NJEiIudy/AfauqE9auB5ZBqsc4CbgKNzB3CADr0OqltWT1TEZ1LkBQb5AFFqRk8
+U01/CRNDxPNgW5a1/JrYfzUgp1eI/1aDXda02gL4oNfzYDxln30lVO8MM5U1gQAa
+Q4bOGHPGL3UYpCsVXVLmwUMwfz1q1Q==
+=/CPf
-----END PGP SIGNATURE-----
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/XS.pm
new/Cpanel-JSON-XS-4.11/XS.pm
--- old/Cpanel-JSON-XS-4.10/XS.pm 2019-03-10 12:01:16.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/XS.pm 2019-03-26 17:45:45.000000000 +0100
@@ -1,5 +1,5 @@
package Cpanel::JSON::XS;
-our $VERSION = '4.10';
+our $VERSION = '4.11';
our $XS_VERSION = $VERSION;
# $VERSION = eval $VERSION;
@@ -118,7 +118,7 @@
strings. Cpanel::JSON::XS is a bit slower, but preserves numeric
types better.
-- numbers ending with .0 stay numbers, are not converted to
+- numbers ending with .0 stray 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
@@ -191,7 +191,7 @@
decode_json(, allow_nonref) arg.
relaxed implements allow_dupkeys.
-- support all 5 unicode BOM's: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE,
+- support all 5 unicode L<BOM|/BOM>'s: UTF-8, UTF-16LE, UTF-16BE, UTF-32LE,
UTF-32BE, encoding internally to UTF-8.
=cut
@@ -1358,6 +1358,9 @@
Detect all unicode B<Byte Order Marks> on decode.
Which are UTF-8, UTF-16LE, UTF-16BE, UTF-32LE and UTF-32BE.
+The BOM encoding is set only for one specific decode call, it does not
+change the state of the JSON object.
+
B<Warning>: With perls older than 5.20 you need load the Encode module
before loading a multibyte BOM, i.e. >= UTF-16. Otherwise an error is
thrown. This is an implementation limitation and might get fixed later.
@@ -2220,14 +2223,14 @@
be fixed swiftly, though.
Since the JSON::XS author refuses to use a public bugtracker and
-prefers private emails, we've setup a tracker at RT, so you might want
+prefers private emails, we use the tracker at B<github>, so you might want
to report any issues twice. Once in private to MLEHMANN to be fixed in
JSON::XS and one to our the public tracker. Issues fixed by JSON::XS
with a new release will also be backported to Cpanel::JSON::XS and
5.6.2, as long as cPanel relies on 5.6.2 and Cpanel::JSON::XS as our
serializer of choice.
-L<https://rt.cpan.org/Public/Dist/Display.html?Queue=Cpanel-JSON-XS>
+L<https://github.com/rurban/Cpanel-JSON-XS/issues>
=head1 LICENSE
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/XS.xs
new/Cpanel-JSON-XS-4.11/XS.xs
--- old/Cpanel-JSON-XS-4.10/XS.xs 2019-03-18 08:35:37.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/XS.xs 2019-03-26 17:45:45.000000000 +0100
@@ -3745,12 +3745,12 @@
NOT add a byte order mark to the beginning of a JSON text",
"implementations (...) MAY ignore the presence of a byte order
mark rather than treating it as an error". */
- if (UNLIKELY(len > 2 && SvPOK(string))) {
+ if (UNLIKELY(len > 2 && SvPOK(string) && !json->incr_pos)) {
U8 *s = (U8*)SvPVX (string);
if (*s >= 0xEF) {
if (len >= 3 && memEQc(s, UTF8BOM)) {
+ converted = 1 + (json->flags & F_UTF8);
json->flags |= F_UTF8;
- converted++;
offset = 3;
SvPV_set(string, SvPVX_mutable (string) + 3);
SvCUR_set(string, len - 3);
@@ -3758,22 +3758,22 @@
/* omitting the endian name will skip the BOM in the result */
} else if (len >= 4 && memEQc(s, UTF32BOM)) {
string = decode_bom(aTHX_ "UTF-32", string, 4);
+ converted = 1 + (json->flags & F_UTF8);
json->flags |= F_UTF8;
- converted++;
} else if (memEQc(s, UTF16BOM)) {
string = decode_bom(aTHX_ "UTF-16", string, 2);
+ converted = 1 + (json->flags & F_UTF8);
json->flags |= F_UTF8;
- converted++;
} else if (memEQc(s, UTF16BOM_BE)) {
string = decode_bom(aTHX_ "UTF-16", string, 2);
+ converted = 1 + (json->flags & F_UTF8);
json->flags |= F_UTF8;
- converted++;
}
} else if (UNLIKELY(len >= 4 && !*s && memEQc(s, UTF32BOM_BE))) {
string = decode_bom(aTHX_ "UTF-32", string, 4);
+ converted = 1 + (json->flags & F_UTF8);
json->flags |= F_UTF8;
- converted++;
- }
+ }
}
if (LIKELY(!converted)) {
@@ -3850,6 +3850,8 @@
if (!(dec.json.flags & F_ALLOW_NONREF) && json_nonref(aTHX_ sv))
croak ("JSON text must be an object or array (but found number, string,
true, false or null, use allow_nonref to allow this)");
+ if (UNLIKELY(converted && !(converted - 1))) /* with BOM, and UTF8 was not
set */
+ json->flags &= ~F_UTF8;
return sv_2mortal (sv);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/ppport.h
new/Cpanel-JSON-XS-4.11/ppport.h
--- old/Cpanel-JSON-XS-4.10/ppport.h 2018-01-30 14:18:43.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/ppport.h 2019-03-26 17:45:45.000000000 +0100
@@ -1,3 +1,4 @@
+
#if 0
<<'SKIP';
#endif
@@ -4590,14 +4591,16 @@
# undef isPRINT
# endif
-#ifdef HAS_QUAD
-# ifdef U64TYPE
-# define WIDEST_UTYPE U64TYPE
+#ifndef WIDEST_UTYPE
+# ifdef QUADKIND
+# ifdef U64TYPE
+# define WIDEST_UTYPE U64TYPE
+# else
+# define WIDEST_UTYPE Quad_t
+# endif
# else
-# define WIDEST_UTYPE Quad_t
+# define WIDEST_UTYPE U32
# endif
-#else
-# define WIDEST_UTYPE U32
#endif
#ifndef isALNUMC
# define isALNUMC(c) (isALPHA(c) || isDIGIT(c))
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/Cpanel-JSON-XS-4.10/t/31_bom.t
new/Cpanel-JSON-XS-4.11/t/31_bom.t
--- old/Cpanel-JSON-XS-4.10/t/31_bom.t 2018-01-30 14:18:43.000000000 +0100
+++ new/Cpanel-JSON-XS-4.11/t/31_bom.t 2019-03-26 17:45:45.000000000 +0100
@@ -2,10 +2,12 @@
#
# https://tools.ietf.org/html/rfc7159#section-8.1
# JSON text SHALL be encoded in UTF-8, UTF-16, or UTF-32.
-use Test::More ($] >= 5.008) ? (tests => 5) : (skip_all => "needs 5.8");;
+use Test::More ($] >= 5.008) ? (tests => 9) : (skip_all => "needs 5.8");;
use Cpanel::JSON::XS;
use Encode; # Currently required for <5.20
+use charnames qw(:short);
use utf8;
+
my $json = Cpanel::JSON::XS->new->utf8->allow_nonref;
# parser need to succeed, result should be valid
@@ -28,3 +30,14 @@
for my $bom (@bom) {
y_pass(@$bom);
}
+
+# [GH #125] BOM in the middle corrupts state, sets utf8 flag
+my $j = Cpanel::JSON::XS->new;
+
+ok(my $as_json = eval {
+ $j->encode({ example => "data with non-ASCII characters",
+ unicode => "\N{greek:Sigma}" })
+}, 'can encode a basic structure');
+ok(eval { $j->decode($as_json) }, 'can decode again');
+ok(eval { $j->decode("\x{feff}" . $as_json) }, 'can decode with BOM');
+ok(eval { $j->decode($as_json) }, 'can decode original');