summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--pp.c4
-rw-r--r--t/op/splice.t12
2 files changed, 15 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index a1558debe7..b777f39509 100644
--- a/pp.c
+++ b/pp.c
@@ -5347,6 +5347,10 @@ PP(pp_splice)
*MARK = &PL_sv_undef;
Safefree(tmparyval);
}
+
+ if (SvMAGICAL(ary))
+ mg_set(MUTABLE_SV(ary));
+
SP = MARK;
RETURN;
}
diff --git a/t/op/splice.t b/t/op/splice.t
index 1ffcb498a7..93718a15cb 100644
--- a/t/op/splice.t
+++ b/t/op/splice.t
@@ -1,6 +1,6 @@
#!./perl
-print "1..18\n";
+print "1..20\n";
@a = (1..10);
@@ -82,3 +82,13 @@ print "ok 17\n";
splice( @a, 1, 2, $a[1], $a[1] );
print "not " unless j(@a) eq j(1,2,2);
print "ok 18\n";
+
+# splice should invoke get magic
+
+print "not " if Foo->isa('Bar');
+print "ok 19\n";
+
+splice @Foo::ISA, 0, 0, 'Bar';
+
+print "not " if !Foo->isa('Bar');
+print "ok 20\n";