summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/pp.c b/pp.c
index 1621df5041..c6bb0a53ab 100644
--- a/pp.c
+++ b/pp.c
@@ -561,7 +561,13 @@ PP(pp_bless)
else {
SV *ssv = POPs;
STRLEN len;
- char *ptr = SvPV(ssv,len);
+ char *ptr;
+
+ if (ssv && SvGMAGICAL(ssv))
+ mg_get(ssv);
+ if (SvROK(ssv))
+ Perl_croak(aTHX_ "Attempt to bless into a reference");
+ ptr = SvPV(ssv,len);
if (ckWARN(WARN_MISC) && len == 0)
Perl_warner(aTHX_ WARN_MISC,
"Explicit blessing to '' (assuming package main)");