This is part of ticket #119433.
Commit ce0d49f changed AVs to use NULL for nonexistent elements. The
mro lookup code was not accounting for that, causing Class::Contract’s
tests to crash (and perhaps other modules, too).
SSize_t items = AvFILLp(isa) + 1;
SV** isa_ptr = AvARRAY(isa);
while(items--) {
- SV* const isa_item = *isa_ptr++;
+ SV* const isa_item = *isa_ptr ? *isa_ptr : &PL_sv_undef;
HV* const isa_item_stash = gv_stashsv(isa_item, 0);
+ isa_ptr++;
if(!isa_item_stash) {
/* if no stash, make a temporary fake MRO
containing just itself */
/* foreach(@ISA) */
while (items--) {
- SV* const sv = *svp++;
+ SV* const sv = *svp ? *svp : &PL_sv_undef;
HV* const basestash = gv_stashsv(sv, 0);
SV *const *subrv_p;
I32 subrv_items;
+ svp++;
if (!basestash) {
/* if no stash exists for this @ISA member,
@INC = '../lib';
require q(./test.pl);
}
-plan(tests => 60);
+plan(tests => 61);
require mro;
is $destroy_output, "new",
'Changes to UNIVERSAL::DESTROY invalidate DESTROY caches';
undef *UNIVERSAL::DESTROY;
+
+{
+ no warnings 'uninitialized';
+ $#_119433::ISA++;
+ pass "no crash when ISA contains nonexistent elements";
+}
object_ok($ref, $class, $package);
}
}
+
+package _119433 {
+ use mro 'c3';
+ no warnings 'uninitialized';
+ $#_119433::ISA++;
+ ::pass "no crash when ISA contains nonexistent elements";
+}