develooper Front page | perl.perl5.porters | Postings from February 2018

[perl #132833] COW bug in :encoding layer

Thread Next
From:
perlbug-followup
Date:
February 8, 2018 20:17
Subject:
[perl #132833] COW bug in :encoding layer
Message ID:
rt-4.0.24-4540-1518121020-366.132833-75-0@perl.org
# New Ticket Created by   
# Please include the string:  [perl #132833]
# in the subject line of all future correspondence about this issue. 
# <URL: https://rt.perl.org/Ticket/Display.html?id=132833 >


Following code modifies variable $valid:

use strict;
use warnings;
use Data::Dumper;

my $valid = "\x61\x00\x00\x00";
my $tmp = $valid;
print Dumper $valid;
open my $fh, '<:encoding(UTF32-LE)', \$tmp or die;
my $str = <$fh>;
close $fh;
print Dumper $valid;

Output is:

$VAR1 = 'a';
$VAR1 = '';

This is perl 5, version 24, subversion 1 (v5.24.1) built for x86_64-linux-gnu-thread-multi


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About