Skip Menu |
 

This queue is for tickets about the PHP-Serialization CPAN distribution.

Report information
The Basics
Id: 82891
Status: new
Priority: 0/
Queue: PHP-Serialization

People
Owner: Nobody in particular
Requestors: SSEVERIN [...] cpan.org
Cc: sns-perl [...] severinghaus.org
AdminCc:

Bug Information
Severity: Normal
Broken in: 0.34
Fixed in: (no value)



CC: sns-perl [...] severinghaus.org
Subject: Serializing an object that acts like a scalar fails
Download (untitled) / with headers
text/plain 1.1k
The error appears as something like this: Not a HASH reference at /usr/share/perl5/PHP/Serialization.pm line 454. The issue was in the $type eq 'obj' condition, at scalar(keys %{$val}). In my case, $val was indeed an object, of class JSON::backportPP::Boolean, but I think it was not something that could be treated as a hashref. It appeared that its value in a scalar context was simply the string "true". I hacked around it at line 453 in a way that is not worth submitting as a patch: if($class eq 'JSON::backportPP::Boolean') { $buffer .= sprintf('i:%d;', $val eq 'true' ? 1 : 0); } A sort of minimal test case, as dumped by Data::Dumper and hand- sanitized of sensitive data is this object: $x = { foo => 1234, bar => { baz => bless( do{\(my $o = 1)}, 'JSON::backportPP::Boolean' ), quux => $VAR1->[0]{permissions}{baz}, } }; So I would expect $x->{bar}{baz} == $x->{bar}{quux} == 1, which is what my hack accomplishes for this one case. I could possibly provide more information about that JSON class if it would help, but I don't happen to know anything about it off the top of my head.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.