Bug#376329: utf-8 total weirdness

Niko Tyni ntyni at debian.org
Tue Jan 26 21:06:20 UTC 2010


forwarded 376329 http://rt.perl.org/rt3/Public/Bug/Display.html?id=72398
thanks

On Sun, Jul 02, 2006 at 01:37:42AM -0400, Joey Hess wrote:
> Package: perl
> Version: 5.8.8-6
> Severity: normal

> joey at kodama:~/tmp/repor/testcase>./repro
> a
> b
> Wide character in subroutine entry at /usr/bin/markdown line 360.
> zsh: exit 255   ./repro

> <paravoid> that's freaking weird
> <paravoid> the utf8 flag gets enabled after the regexp is run

Here's a reduced testcase:

#!perl
use Digest::MD5 qw(md5_hex);

qq[\x{263a}] =~ /(.)/ and "$1"; # vivify $1 with utf8 flag

"\303\244" =~ /(.)/ and do {
    # "$1"; #uncomment this and it goes away
    print md5_hex($1), "\n";;
}
__END__

The problem seems to be that the utf8 flag of $1 is checked before its
"get magic" has been applied to it, and the old value of the flag makes
Digest::MD5 croak incorrectly.

Workarounds include peeking at the contents $1 somehow (for example by
stringifying it with md5_hex("$1") or resetting it first with another
match.

This is still reproducible on bleadperl (5.11.4 or so), and I just filed 
upstream ticket [perl #72398].
-- 
Niko Tyni   ntyni at debian.org






More information about the Perl-maintainers mailing list