From f28098ff87449d3722db2e2f1fbf980414334637 Mon Sep 17 00:00:00 2001 From: Rafael Garcia-Suarez Date: Fri, 27 Dec 2002 17:14:24 +0100 Subject: [PATCH] Re: [perl #19330] Uneffective increment of $\ Message-Id: <20021227161424.17234e3c.rgarciasuarez@free.fr> p4raw-id: //depot/perl@18371 --- mg.c | 2 +- t/op/magic.t | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/mg.c b/mg.c index ea15875..408c7de 100644 --- a/mg.c +++ b/mg.c @@ -818,7 +818,7 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg) break; case '\\': if (PL_ors_sv) - sv_setpv(sv,SvPVX(PL_ors_sv)); + sv_copypv(sv, PL_ors_sv); break; case '#': sv_setpv(sv,PL_ofmt); diff --git a/t/op/magic.t b/t/op/magic.t index cbf8564..0619c0d 100755 --- a/t/op/magic.t +++ b/t/op/magic.t @@ -36,7 +36,7 @@ sub skip { return 1; } -print "1..48\n"; +print "1..50\n"; $Is_MSWin32 = $^O eq 'MSWin32'; $Is_NetWare = $^O eq 'NetWare'; @@ -324,3 +324,20 @@ ok ${^TAINT} == 0; ok "@-" eq "0 0 2 7"; ok "@+" eq "10 1 6 10"; +# Tests for the magic get of $\ +{ + my $ok = 0; + # [perl #19330] + { + local $\ = undef; + $\++; $\++; + $ok = $\ eq 2; + } + ok $ok; + $ok = 0; + { + local $\ = "a\0b"; + $ok = "a$\b" eq "aa\0bb"; + } + ok $ok; +} -- 2.7.4