This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Perl_sv_uni_display() needs to be aware of RX_WRAPPED()
[perl5.git] / utf8.c
diff --git a/utf8.c b/utf8.c
index ba1304e..511e845 100644 (file)
--- a/utf8.c
+++ b/utf8.c
@@ -4428,9 +4428,12 @@ The pointer to the PV of the C<dsv> is returned.
 char *
 Perl_sv_uni_display(pTHX_ SV *dsv, SV *ssv, STRLEN pvlim, UV flags)
 {
+    const char * const ptr =
+        isREGEXP(ssv) ? RX_WRAPPED((REGEXP*)ssv) : SvPVX_const(ssv);
+
     PERL_ARGS_ASSERT_SV_UNI_DISPLAY;
 
-     return Perl_pv_uni_display(aTHX_ dsv, (const U8*)SvPVX_const(ssv),
+    return Perl_pv_uni_display(aTHX_ dsv, (const U8*)ptr,
                                SvCUR(ssv), pvlim, flags);
 }