Fix a bug in mad - regexps can be 8 bit, not just ASCII or UTF-8.
Nicholas Clark [Sun, 6 Jan 2008 13:04:51 +0000 (13:04 +0000)]
p4raw-id: //depot/perl@32866

dump.c

diff --git a/dump.c b/dump.c
index d397616..3e4db86 100644 (file)
--- a/dump.c
+++ b/dump.c
@@ -2468,9 +2468,8 @@ Perl_do_pmop_xmldump(pTHX_ I32 level, PerlIO *file, const PMOP *pm)
     level++;
     if (PM_GETRE(pm)) {
        REGEXP *const r = PM_GETRE(pm);
-       /* FIXME ORANGE - REGEXP can be 8 bit, so this is sometimes buggy:  */
-       SV * const tmpsv = newSVpvn(RX_PRECOMP(r),RX_PRELEN(r));
-       SvUTF8_on(tmpsv);
+       SV * const tmpsv = newSVsv((SV*)r);
+       sv_utf8_upgrade(tmpsv);
        Perl_xmldump_indent(aTHX_ level, file, "pre=\"%s\"\n",
             SvPVX(tmpsv));
        SvREFCNT_dec(tmpsv);