summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorHugo van der Sanden <hv@crypt.org>2000-08-07 17:59:38 +0100
committerJarkko Hietaniemi <jhi@iki.fi>2000-08-07 16:12:27 +0000
commit81689caa70f1ebdcb0b17a51c3e0742ee11ec130 (patch)
tree9176563e9a9dbc3242f7453a347c35ccf1aa34bf /pp.c
parent427f4adb1817daf51d5b7762a1ebb87394ca8ac8 (diff)
downloadperl-81689caa70f1ebdcb0b17a51c3e0742ee11ec130.tar.gz
Make bless(REF, REF) a fatal error, add bless tests.
Subject: [PATCH bleadperl-6530] bless, REF, and bless(REF, REF) Message-Id: <200008071559.QAA29541@crypt.compulink.co.uk> p4raw-id: //depot/perl@6539
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)");