Skip Menu |
Report information
Id: 79178
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: polarcluster [at] gmail.com
Cc:
AdminCc:

Operating System: (no value)
PatchStatus: (no value)
Severity: low
Type: core
Perl Version: 5.12.0
Fixed In: (no value)



Subject: Perl 5.12: STORE/FETCH of tie()d hash get literal stringref key stringified
Date: Sun, 14 Nov 2010 02:16:17 +0200
To: <perlbug [...] perl.org>
From: "Alex" <polarcluster [...] gmail.com>
Download (untitled) / with headers
text/plain 659b
# Perl 5.12: STORE/FETCH of tie()d hash get literal stringref key # stringified. This bug emerged in perl v5.12, prior perls are fine. It # affects only literal stringref used as key for tie()d hash # storing/fetching (the same stringref stored in variable works fine)... tie %a, 'Foo'; $a{\'foo'} = undef; # 5.10.1 prints: 'SCALAR'; 5.12.0 - 5.12.2 prints '' $a{\'foo'}; # same $stringref = \'foo'; $a{$stringref} = undef; # prints 'SCALAR' $a{$stringref}; # prints 'SCALAR' $a{\$scalar} = undef; # prints 'SCALAR' $a{\$scalar}; # prints 'SCALAR' package Foo; sub TIEHASH { bless {}, $_[0] } sub STORE { print ref $_[1] } sub FETCH { print ref $_[1] }
Fixed by 04698ff6.
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 216b
On Sat Nov 27 07:16:42 2010, sprout wrote: Show quoted text
> Fixed by 04698ff6.
But that only fixed $hash{\"ref"}. 649c173f8 fixes $hash{+undef_constant}, which could arguably also belong in this ticket. -- Father Chrysostomos


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

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org