Skip to content

Commit

Permalink
Don’t push nulls on to the stack in pp_padav
Browse files Browse the repository at this point in the history
This is something that ce0d59f missed.

This will probably fix most of the modules mentioned in
ticket #119433.
  • Loading branch information
Father Chrysostomos committed Aug 25, 2013
1 parent 81f1be6 commit 428ccf1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion pp.c
Expand Up @@ -98,7 +98,11 @@ PP(pp_padav)
}
}
else {
Copy(AvARRAY((const AV *)TARG), SP+1, maxarg, SV*);
PADOFFSET i;
for (i=0; i < (PADOFFSET)maxarg; i++) {
SV * const sv = AvARRAY((const AV *)TARG)[i];
SP[i+1] = sv ? sv : &PL_sv_undef;
}
}
SP += maxarg;
}
Expand Down
6 changes: 5 additions & 1 deletion t/op/array.t
Expand Up @@ -6,7 +6,7 @@ BEGIN {
require 'test.pl';
}

plan (136);
plan (137);

#
# @foo, @bar, and @ary are also used from tie-stdarray after tie-ing them
Expand Down Expand Up @@ -472,6 +472,10 @@ sub {
'exists returns true for &PL_sv_undef elem [perl #7508]';
is \$_[0], \undef, 'undef preserves identity in array [perl #109726]';
}->(undef);
# and that padav also knows how to handle the resulting NULLs
@_ = sub { my @a; $a[1]=1; @a }->();
is join (" ", map $_//"undef", @_), "undef 1",
'returning my @a with nonexistent elements';

# [perl #118691]
@plink=@plunk=();
Expand Down

0 comments on commit 428ccf1

Please sign in to comment.