From: Rafael Garcia-Suarez Date: Thu, 14 Jun 2007 11:06:02 +0000 (+0000) Subject: Fix [perl #43207] lc() or uc() inside sort affect the return value. X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=17fa0776055c3d6ef5e8451cfcb9e194ca912faa;p=p5sagit%2Fp5-mst-13.2.git Fix [perl #43207] lc() or uc() inside sort affect the return value. p4raw-id: //depot/perl@31377 --- diff --git a/pp.c b/pp.c index 830d5fb..51af7d8 100644 --- a/pp.c +++ b/pp.c @@ -3522,7 +3522,7 @@ PP(pp_ucfirst) need = slen + 1; } - if (SvPADTMP(source) && !SvREADONLY(source) && inplace) { + if (SvPADTMP(source) && !SvREADONLY(source) && inplace && SvTEMP(source)) { /* We can convert in place. */ dest = source; @@ -3605,7 +3605,7 @@ PP(pp_uc) SvGETMAGIC(source); if (SvPADTMP(source) && !SvREADONLY(source) && !SvAMAGIC(source) - && !DO_UTF8(source)) { + && SvTEMP(source) && !DO_UTF8(source)) { /* We can convert in place. */ dest = source; @@ -3705,7 +3705,7 @@ PP(pp_lc) SvGETMAGIC(source); if (SvPADTMP(source) && !SvREADONLY(source) && !SvAMAGIC(source) - && !DO_UTF8(source)) { + && SvTEMP(source) && !DO_UTF8(source)) { /* We can convert in place. */ dest = source; diff --git a/t/op/lc.t b/t/op/lc.t index 571868f..1cef380 100644 --- a/t/op/lc.t +++ b/t/op/lc.t @@ -6,7 +6,7 @@ BEGIN { require './test.pl'; } -plan tests => 87; +plan tests => 88; $a = "HELLO.* world"; $b = "hello.* WORLD"; @@ -205,3 +205,10 @@ for (1, 4, 9, 16, 25) { is(lc "\x{0130}" x $_, "i\x{307}" x $_, 'lc U+0130 grows'); } + +# bug #43207 +my $temp = "Hello"; +for ("$temp") { + lc $_; + is($_, "Hello"); +}