CC: | schmorp [...] schmorp.de |
Subject: | Assertion failure (encode_json on string ref) |
With debugging perls there's an assertion failure with the following JSON::XS call:
$ perl5.24.0d -MJSON::XS -e 'encode_json \"foo"'
perl5.24.0d: XS.xs:338: json_nonref: Assertion `((svtype)((_svstash)->sv_flags & 0xff)) >= SVt_PVMG' failed.
[3] 16354 abort (core dumped) perl5.24.0d -MJSON::XS -e 'encode_json \"foo"'
I see this on a Linux (perl 5.24.0) and a FreeBSD system (perl 5.22.1). This error is causing failures in the Search::Elasticsearch test suite, see https://github.com/elastic/elasticsearch-perl/issues/108
Cpanel::JSON::XS does not fail here:
$ perl5.24.0d -MCpanel::JSON::XS -e 'encode_json \"foo"'
cannot encode reference to scalar 'SCALAR(0xa311f0)' unless the scalar is 0 or 1 at -e line 1.