This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
[perl #101738] Make sv_sethek set the UTF8 flag correctly
authorFather Chrysostomos <sprout@cpan.org>
Thu, 20 Oct 2011 06:54:57 +0000 (23:54 -0700)
committerFather Chrysostomos <sprout@cpan.org>
Thu, 20 Oct 2011 13:03:53 +0000 (06:03 -0700)
commitb535e014e67d62ebc1d6f4be7ca9d8aef2d8f9bc
tree2d76e4ca358972b835453df15bf1b4318fc5e515
parent6e6358c8fab5b1ad912d0a7c5f329db10c5b9ffb
[perl #101738] Make sv_sethek set the UTF8 flag correctly

It was only ever turning it on, and not turning it off if the sv hap-
pened to have it on from its previous use.

This caused ref() (which uses sv_sethek(TARG,...)) to return a shared
scalar with the UTF8 flag on, even if it was supposed to be off.

For shared scalars, the UTF8 flag on ASCII strings does make a differ-
ence.  The pv *and* the flags are used in hash lookup, for speed.

So a scalar returned by ref() with the UTF8 flag on by mistake would
not work in hash lookups.  exists $classes{ref $foo} would return
false, even if there were an entry for that class.
sv.c
t/op/ref.t