diff options
author | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-15 18:35:28 +0000 |
---|---|---|
committer | Gurusamy Sarathy <gsar@cpan.org> | 2000-02-15 18:35:28 +0000 |
commit | f8f703809bcc262bbe169574d2c0b30abd6f26ad (patch) | |
tree | 986f73c59dcc4782650bb08998352b5411128380 /universal.c | |
parent | 73659bf1a819ac7d9f9fcae022ed8755e46824eb (diff) | |
download | perl-f8f703809bcc262bbe169574d2c0b30abd6f26ad.tar.gz |
UNIVERSAL::can and UNIVERSAL::isa should return undef when
given undefined values (from Graham Barr <gbarr@pobox.com>)
p4raw-id: //depot/perl@5109
Diffstat (limited to 'universal.c')
-rw-r--r-- | universal.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/universal.c b/universal.c index 1e5a1a0efe..6ccff2f003 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; |