Fix in change 7162 was too-late for case where we "upgraded" to PVIV and
authorNick Ing-Simmons <nik@tiuk.ti.com>
Fri, 6 Oct 2000 20:48:34 +0000 (20:48 +0000)
committerNick Ing-Simmons <nik@tiuk.ti.com>
Fri, 6 Oct 2000 20:48:34 +0000 (20:48 +0000)
got a false +ve and so did not reach code which would have un-FAKEd the SV.

p4raw-id: //depot/perl@7163

sv.c

diff --git a/sv.c b/sv.c
index 633c30d..a2e6fbd 100644 (file)
--- a/sv.c
+++ b/sv.c
@@ -913,6 +913,10 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt)
     MAGIC*     magic;
     HV*                stash;
 
+    if (mt != SVt_PV && SvREADONLY(sv) && SvFAKE(sv)) {
+       sv_force_normal(sv);
+    }
+
     if (SvTYPE(sv) == mt)
        return TRUE;
 
@@ -981,9 +985,6 @@ Perl_sv_upgrade(pTHX_ register SV *sv, U32 mt)
            mt = SVt_PVNV;
        break;
     case SVt_PVIV:
-       if (SvREADONLY(sv) && SvFAKE(sv)) {
-           sv_force_normal(sv);
-       }
        pv      = SvPVX(sv);
        cur     = SvCUR(sv);
        len     = SvLEN(sv);