Cpanel-JSON-XS

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

          e.g. when Math::BigInt/BigFloat fails.
        - Fix encoding Inf and NaN from PV and NV slots to JSON_TYPE_INT
          (#137 by Pali)
        - Fix memory corruption in sv_to_ivuv() function (#136 by Pali)
        - Add new method ->require_types (#135 by Pali)
        - Fix typed json encoder conversion from scalar's PV and NV slot to
          JSON_TYPE_INT (#133, #134 by Pali)
        - Fix inconsistency with warnings in typed json encoder (#131 by Pali)
        - Fix Perl 5.8.0 support (#130 by Pali)
        - Fixed minor pod typo (#129 by sheeit)
        - Document invalid recursive callbacks or overloads (#128)

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)
        - Fix encode_stringify string-overload refcnt problem (#124)

Changes  view on Meta::CPAN

         and numbers are now not mishandled anymore by dual-vars, temp. string representations.
         Add t/117_numbers.t from JSON::PP, PR#10 by kraih.
       - Add prompt for nan/inf encode policy: null or stringify.
       - Change stringification of false and true to 0 and 1, matching upstream JSON and JSON::XS, #29.
         This didn't affect string comparisons, just e.g. print decode_json("false").
       - Tolerate literal ASCII TABs in strings in relaxed mode #22 (from JSON::XS)
       - Revise pod, merge updates from JSON::XS.
       - Fix pod typo #30 (Colin Kuskie)

3.0107 2014-11-28 (rurban)
       - fix fatal stack corruption with perl callbacks in list context
         #27 (dur-randir)

3.0106 2014-11-11 (rurban)
       - more minor doc improvements #26 (schwern)

3.0105 2014-11-05 (rurban)
       - minor doc improvements #25 (ether)
       - fix d_Gconvert test in t/11_pc_expo.t for 5.6

3.0104 2014-04-26 (rurban)

Changes  view on Meta::CPAN


3.0103 2014-04-21 (rurban)
       - Change booleans interop logic (again) for JSON-XS-3.01
         Check now for Types::Serialiser::Boolean ie JSON::PP::Boolean refs (#18 clintongormley)
         to avoid allow_blessed for JSON-XS-3.01 booleans.
       - fix boolean representation for JSON-XS-3.01/Types::Serialiser::Boolean interop
         (arrayref, not hashref)
       - add t/52_object.t from JSON::XS
       - backport encode_hv HE sort on stack < 64 or heap to avoid stack
         overflows from JSON-XS-3.01. do not use alloca.
       - backport allow_tags, decode_tag, FREEZE/THAW callbacks from JSON-XS-3.01
       - added pod for OBJECT SERIALISATION (allow_tags, FREEZE/THAW)

3.0102 2014-04-17 (rurban + bulk88)
       - Added PERL_NO_GET_CONTEXT for better performance on threaded Perls (bulk88)
       - MANIFEST: added t/96_interop.t
       - Document deprecated functions
       - Change booleans interop logic for JSON-XS-3.01

3.0101 2014-04-15 (rurban + bulk88)
       - Added ithreads support (bulk88)

Changes  view on Meta::CPAN

	- revert fix crash with invalid JSON, empty sv 
    
2.33_02 2012-08-17 16:29:52 (rurban)
	- fix crash with invalid JSON, empty sv 

2.33_01 2012-08-08 16:29:52 (rurban)
	- merge with JSON-XS-2.33

2.33 2012-08-01 21:03:52 2012
	- internal encode/decode XS wrappers did not expect stack
          moves caused by callbacks (analyzed and testcase by Jesse Luehrs).
	- add bencode as to/from option in bin/json_xs.
        - add -e option to json_xs, and none and string in/out formats.

2.32_02 2012-06-27 19:59:18 (rurban)
	- forked from JSON-XS-2.32
	- Cpanel perl-5.6.2 support
	- prefix with Cpanel

2.32 2011-08-11 19:06:38
	- fix a bug in the initial whitespace accumulation.

Changes  view on Meta::CPAN

          and analyzed by Goro Fuji).

2.3  2010-08-18 01:26:47
	- make sure decoder doesn't change the decoding in the incremental
          parser (testcase provided by Hendrik Schumacher).
	- applied patch by DaTa for Data::Dumper support in json_xs.
        - added -t dump support to json_xs, using Data::Dump.
        - added -f eval support to json_xs.

2.29  2010-03-17 02:39:12
	- fix a memory leak when callbacks set using filter_json_object
          or filter_json_single_key_object were called (great testcase
          by Eric Wilhelm).

2.28  2010-03-11 20:30:46
	- implement our own atof function - perl's can be orders of
          magnitudes slower than even the system one. on the positive
          side, ours seems to be more exact in general than perl's.
          (testcase provided by Tim Meadowcroft).
        - clarify floating point conversion issues a bit.
	- update jpsykes csrf article url.

README  view on Meta::CPAN

        context and the resulting scalar will be encoded instead of the
        object. If no "TO_JSON" method is found, a stringification overload
        method is tried next. If both are not found, the value of
        "allow_blessed" will decide what to do.

        The "TO_JSON" method may safely call die if it wants. If "TO_JSON"
        returns other blessed objects, those will be handled in the same
        way. "TO_JSON" must take care of not causing an endless recursion
        cycle (== crash) in this case. The same care must be taken with
        calling encode in stringify overloads (even if this works by luck in
        older perls) or other callbacks. The name of "TO_JSON" was chosen
        because other methods called by the Perl core (== not by the user of
        the object) are usually in upper case letters and to avoid
        collisions with any "to_json" function or method.

        If $enable is false (the default), then "encode" will not consider
        this type of conversion.

        This setting has no effect on "decode".

    $json = $json->allow_tags ([$enable])

README  view on Meta::CPAN


    5. none of the above
        If none of the settings are enabled or the respective methods are
        missing, "Cpanel::JSON::XS" throws an exception.

   DESERIALIZATION
    For deserialization there are only two cases to consider: either
    nonstandard tagging was used, in which case "allow_tags" decides, or
    objects cannot be automatically be deserialized, in which case you can
    use postprocessing or the "filter_json_object" or
    "filter_json_single_key_object" callbacks to get some real objects our
    of your JSON.

    This section only considers the tagged value case: I a tagged JSON
    object is encountered during decoding and "allow_tags" is disabled, a
    parse error will result (as if tagged values were not part of the
    grammar).

    If "allow_tags" is enabled, "Cpanel::JSON::XS" will look up the "THAW"
    method of the package/classname used during serialization (it will not
    attempt to load the package as a Perl module). If there is no such

XS.pm  view on Meta::CPAN

and the resulting scalar will be encoded instead of the object. If no
C<TO_JSON> method is found, a stringification overload method is tried next.
If both are not found, the value of C<allow_blessed> will decide what
to do.

The C<TO_JSON> method may safely call die if it wants. If C<TO_JSON>
returns other blessed objects, those will be handled in the same
way. C<TO_JSON> must take care of not causing an endless recursion
cycle (== crash) in this case. The same care must be taken with
calling encode in stringify overloads (even if this works by luck in
older perls) or other callbacks.  The name of C<TO_JSON> was chosen
because other methods called by the Perl core (== not by the user of
the object) are usually in upper case letters and to avoid collisions
with any C<to_json> function or method.

If C<$enable> is false (the default), then C<encode> will not consider
this type of conversion.

This setting has no effect on C<decode>.

=item $json = $json->allow_tags ([$enable])

XS.pm  view on Meta::CPAN

C<Cpanel::JSON::XS> throws an exception.

=back

=head3 DESERIALIZATION

For deserialization there are only two cases to consider: either
nonstandard tagging was used, in which case C<allow_tags> decides,
or objects cannot be automatically be deserialized, in which
case you can use postprocessing or the C<filter_json_object> or
C<filter_json_single_key_object> callbacks to get some real objects our of
your JSON.

This section only considers the tagged value case: I a tagged JSON object
is encountered during decoding and C<allow_tags> is disabled, a parse
error will result (as if tagged values were not part of the grammar).

If C<allow_tags> is enabled, C<Cpanel::JSON::XS> will look up the C<THAW> method
of the package/classname used during serialization (it will not attempt
to load the package as a Perl module). If there is no such method, the
decoding will fail with an error.

XS.xs  view on Meta::CPAN

        if (*dec->cur == '}' && dec->json.flags & F_RELAXED)
          {
            ++dec->cur;
            break;
          }
      }

  DEC_DEC_DEPTH;
  sv = newRV_noinc ((SV *)hv);

  /* check filter callbacks */
  if (dec->json.flags & F_HOOK)
    {
      if (dec->json.cb_sk_object && HvKEYS (hv) == 1)
        {
          HE *cb = NULL, *he;

          hv_iterinit (hv);
          he = hv_iternext (hv);
          hv_iterinit (hv);



( run in 0.433 second using v1.01-cache-2.11-cpan-9b1e4054eb1 )