summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2002-12-27 17:14:24 +0100
committerhv <hv@crypt.org>2002-12-30 03:08:12 +0000
commitf28098ff87449d3722db2e2f1fbf980414334637 (patch)
tree8c1e079543030264eeb4bc0670c6aeaf13bb2d87
parenta5db57d6e186f7924a69b589e2f061c7ee693deb (diff)
downloadperl-f28098ff87449d3722db2e2f1fbf980414334637.tar.gz
Re: [perl #19330] Uneffective increment of $\
Message-Id: <20021227161424.17234e3c.rgarciasuarez@free.fr> p4raw-id: //depot/perl@18371
-rw-r--r--mg.c2
-rwxr-xr-xt/op/magic.t19
2 files changed, 19 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index ea15875215..408c7debf2 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 cbf8564497..0619c0dc34 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;
+}