From: Gurusamy Sarathy Date: Tue, 15 Feb 2000 18:35:28 +0000 (+0000) Subject: UNIVERSAL::can and UNIVERSAL::isa should return undef when X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=f8f703809bcc262bbe169574d2c0b30abd6f26ad;p=p5sagit%2Fp5-mst-13.2.git UNIVERSAL::can and UNIVERSAL::isa should return undef when given undefined values (from Graham Barr ) p4raw-id: //depot/perl@5109 --- diff --git a/universal.c b/universal.c index 1e5a1a0..6ccff2f 100644 --- a/universal.c +++ b/universal.c @@ -140,6 +140,10 @@ XS(XS_UNIVERSAL_isa) Perl_croak(aTHX_ "Usage: UNIVERSAL::isa(reference, kind)"); sv = ST(0); + + if (!SvOK(sv) || !(SvROK(sv) || SvCUR(sv))) + XSRETURN_UNDEF; + name = (char *)SvPV(ST(1),n_a); ST(0) = boolSV(sv_derived_from(sv, name)); @@ -159,6 +163,10 @@ XS(XS_UNIVERSAL_can) Perl_croak(aTHX_ "Usage: UNIVERSAL::can(object-ref, method)"); sv = ST(0); + + if (!SvOK(sv) || !(SvROK(sv) || SvCUR(sv))) + XSRETURN_UNDEF; + name = (char *)SvPV(ST(1),n_a); rv = &PL_sv_undef;