summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-02-13 22:08:06 +0100
committerRafael Garcia-Suarez <rgarciasuarez@gmail.com>2009-02-13 22:08:06 +0100
commit33570f8ba08e966c4572bcd9146cb9580efcac82 (patch)
tree2c8c75d5ab2388b03055b83e462ae2c9355bae56 /pp_ctl.c
parent161d9976705d696949da2e59561389dfd8120591 (diff)
downloadperl-33570f8ba08e966c4572bcd9146cb9580efcac82.tar.gz
$object ~~ undef should always test for definedness
(even if $object hasn't overloaded the ~~ operator)
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index f118d57c60..f512832a30 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -4087,8 +4087,12 @@ S_do_smartmatch(pTHX_ HV *seen_this, HV *seen_other)
if (SvGMAGICAL(e))
e = sv_mortalcopy(e);
- if (SM_OBJECT)
- Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
+ if (SM_OBJECT) {
+ if (!SvOK(d) || !SvOK(e))
+ RETPUSHNO;
+ else
+ Perl_croak(aTHX_ "Smart matching a non-overloaded object breaks encapsulation");
+ }
if (SM_CV_NEP) {
I32 c;