Skip Menu |
 

This queue is for tickets about the YAML-Syck CPAN distribution.

Report information
The Basics
Id: 17411
Status: resolved
Priority: 0/
Queue: YAML-Syck

People
Owner: Nobody in particular
Requestors: stephen [...] jadevine.org.uk
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 0.28



Subject: String '~' gets mangled to undef
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
X-RT-Original-Encoding: utf-8
Content-Type: multipart/mixed; boundary="----------=_1138792895-28588-35"
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
Content-Length: 548
Download (untitled) / with headers
text/plain 548b
I have discovered that if a hash value is the string '~' then doing a dump and load will convert into an undef. Here is a test (also attached) which shows the broken behaviour: #!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use YAML::Syck (); my $data = { foo => '~' }; my $yaml = YAML::Syck::Dump($data); my $data2 = YAML::Syck::Load($yaml); is_deeply($data, $data2, '~ should be returned as ~ not undef'); This is causing me quite a bit of trouble so I have marked the bug as 'important'. Thanks, Stephen Quinney
Subject: test.pl
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="----------=_1138792895-28588-34"
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Length: 0
Content-Type: text/plain; charset="utf8"
Content-Disposition: inline
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
Content-Length: 0
Content-Type: text/x-perl; name="test.pl"
Content-Disposition: inline; filename="test.pl"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: ascii
Content-Length: 263
Download test.pl
text/x-perl 263b
#!/usr/bin/perl use strict; use warnings; use Test::More tests => 1; use YAML::Syck (); my $data = { foo => '~' }; my $yaml = YAML::Syck::Dump($data); my $data2 = YAML::Syck::Load($yaml); is_deeply($data, $data2, '~ should be returned as ~ not undef');
MIME-Version: 1.0
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
Message-Id: <rt-3.5.HEAD-28588-1138802557-1215.17411-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 354
Download (untitled) / with headers
text/plain 354b
To add some more information to this bug report, the problem is in the emitter not the parser. Here's an example that shows this: perl -mYAML::Syck -e '$h={foo=>"~"}; print YAML::Syck::Dump($h);' --- foo: ~ That ~ should be quoted in the output otherwise the Load method will read it as meaning undef rather than as a literal string. Stephen Quinney
MIME-Version: 1.0
In-Reply-To: <rt-3.5.HEAD-28588-1138802557-1215.17411-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.418 (Entity 5.418)
Content-Disposition: inline
References: <rt-3.5.HEAD-28588-1138802557-1215.17411-0-0 [...] rt.cpan.org>
Message-Id: <rt-3.5.HEAD-24393-1139226193-691.17411-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf8"
Content-Transfer-Encoding: binary
From: Audrey T.
X-RT-Original-Encoding: utf-8
X-RT-Original-Encoding: utf-8
Content-Length: 22
Thanks, fixed in 0.30.


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.