diff options
author | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-02-13 22:08:06 +0100 |
---|---|---|
committer | Rafael Garcia-Suarez <rgarciasuarez@gmail.com> | 2009-02-13 22:08:06 +0100 |
commit | 33570f8ba08e966c4572bcd9146cb9580efcac82 (patch) | |
tree | 2c8c75d5ab2388b03055b83e462ae2c9355bae56 /pp_ctl.c | |
parent | 161d9976705d696949da2e59561389dfd8120591 (diff) | |
download | perl-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.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; |