summaryrefslogtreecommitdiff
path: root/pp.c
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2013-10-31 05:13:25 -0700
committerFather Chrysostomos <sprout@cpan.org>2013-10-31 15:47:03 -0700
commit8d9dd4b93fdcb05efbddfcdc0ca729324cfb60c6 (patch)
tree943dd2807bb609ab7239fc7015512995d42cf39c /pp.c
parent6f80f2fde68ead297fd758a9077e77783f96196d (diff)
downloadperl-8d9dd4b93fdcb05efbddfcdc0ca729324cfb60c6.tar.gz
[perl #119809] Disallow bless($ref, $tied_ref)
There is no reason tied (or otherwise magical variables like $/) should be exempt from the ‘Attempt to bless into a reference’ error.
Diffstat (limited to 'pp.c')
-rw-r--r--pp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index f1f224ee3e..f899a3f809 100644
--- a/pp.c
+++ b/pp.c
@@ -616,9 +616,10 @@ PP(pp_bless)
const char *ptr;
if (!ssv) goto curstash;
- if (!SvGMAGICAL(ssv) && !SvAMAGIC(ssv) && SvROK(ssv))
+ SvGETMAGIC(ssv);
+ if (!SvAMAGIC(ssv) && SvROK(ssv))
Perl_croak(aTHX_ "Attempt to bless into a reference");
- ptr = SvPV_const(ssv,len);
+ ptr = SvPV_nomg_const(ssv,len);
if (len == 0)
Perl_ck_warner(aTHX_ packWARN(WARN_MISC),
"Explicit blessing to '' (assuming package main)");