This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
op.c:ck_svconst: Don’t allow ro COWs under old COW
[perl5.git] / op.c
diff --git a/op.c b/op.c
index fc0f130..a209110 100644 (file)
--- a/op.c
+++ b/op.c
@@ -10558,6 +10558,9 @@ Perl_ck_svconst(pTHX_ OP *o)
 {
     PERL_ARGS_ASSERT_CK_SVCONST;
     PERL_UNUSED_CONTEXT;
+#ifdef PERL_OLD_COPY_ON_WRITE
+    if (SvIsCOW(cSVOPo->op_sv)) sv_force_normal(cSVOPo->op_sv);
+#endif
     SvREADONLY_on(cSVOPo->op_sv);
     return o;
 }