summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doop.c2
-rw-r--r--t/op/gmagic.t6
2 files changed, 6 insertions, 2 deletions
diff --git a/doop.c b/doop.c
index 8bd7c0f414..8bff60aa0a 100644
--- a/doop.c
+++ b/doop.c
@@ -1033,7 +1033,7 @@ Perl_do_chop(pTHX_ register SV *astr, register SV *sv)
s = SvPV(sv, len);
if (len && !SvPOK(sv))
- s = SvPV_force(sv, len);
+ s = SvPV_force_nomg(sv, len);
if (DO_UTF8(sv)) {
if (s && len) {
char * const send = s + len;
diff --git a/t/op/gmagic.t b/t/op/gmagic.t
index ab6d2ee3e6..ce05aff906 100644
--- a/t/op/gmagic.t
+++ b/t/op/gmagic.t
@@ -6,7 +6,7 @@ BEGIN {
@INC = '../lib';
}
-print "1..18\n";
+print "1..20\n";
my $t = 1;
tie my $c => 'Tie::Monitor';
@@ -50,6 +50,10 @@ ok_string($s, 'x0', 2, 1);
$s = $c = $c . $c;
ok_string($s, '00', 3, 1);
+# multiple magic in core functions
+$s = chop($c);
+ok_string($s, '0', 1, 1);
+
# adapted from Tie::Counter by Abigail
package Tie::Monitor;