diff options
author | Father Chrysostomos <sprout@cpan.org> | 2014-11-13 18:13:01 -0800 |
---|---|---|
committer | Father Chrysostomos <sprout@cpan.org> | 2014-11-13 18:13:01 -0800 |
commit | 659fbb76ee3f02400a3c64ff42319112d4ba31d6 (patch) | |
tree | 13fa8351d940d1e25e64564153b9483034ee3fc2 /t/op | |
parent | fbc76eb33c666bb9846ba7e30deeccdbd986513c (diff) | |
download | perl-659fbb76ee3f02400a3c64ff42319112d4ba31d6.tar.gz |
Stop crypt($tied,...) from calling FETCH twice
It was doing so if FETCH returned a UTF8 string the first time. It
then turned on the UTF8 flag on the result of the second FETCH, even
if it wasn’t UTF8:
$ ./miniperl -e 'sub TIESCALAR{bless[substr(chr 256,0,0), chr 255]} sub FETCH{shift @{$_[0]}}tie $t, ""; crypt $t, ""'
Wide character in crypt at -e line 1.
(There are no wide characters fed to crypt() there.)
Diffstat (limited to 't/op')
-rw-r--r-- | t/op/tie_fetch_count.t | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/t/op/tie_fetch_count.t b/t/op/tie_fetch_count.t index 6955d19a76..28a4355478 100644 --- a/t/op/tie_fetch_count.t +++ b/t/op/tie_fetch_count.t @@ -7,7 +7,7 @@ BEGIN { chdir 't' if -d 't'; require './test.pl'; set_up_inc('../lib'); - plan (tests => 340); + plan (tests => 344); } use strict; @@ -244,6 +244,13 @@ for ([chdir=>''],[chmod=>'0,'],[chown=>'0,0,'],[utime=>'0,0,'], check_count "$op $args\\\$tied_glob$postargs"; } +$dummy = crypt $var,0; check_count 'crypt $tied, ...'; +$dummy = crypt 0,$var; check_count 'crypt ..., $tied'; +$var = substr(chr 256,0,0); +$dummy = crypt $var,0; check_count 'crypt $tied_utf8, ...'; +$var = substr(chr 256,0,0); +$dummy = crypt 0,$var; check_count 'crypt ..., $tied_utf8'; + { no warnings; $var = *foo; |