When assigning undef to its target, readline needs to take into
account that it might be a typeglob. sv_setsv knows how handle this,
but SvOK_off is simply wrong.
This fixes this particular crash, but other issues in the ticket are
as yet unresolved.
if (gimme == G_SCALAR) {
/* undef TARG, and push that undefined value */
if (type != OP_RCATLINE) {
- SV_CHECK_THINKFIRST_COW_DROP(TARG);
- SvOK_off(TARG);
+ sv_setsv(TARG,NULL);
}
PUSHTARG;
}
set_up_inc('../lib');
}
-plan tests => 31;
+plan tests => 32;
# [perl #19566]: sv_gets writes directly to its argument via
# TARG. Test that we respect SvREADONLY.
readline undef;
is ${^LAST_FH}, undef, '${^LAST_FH} after readline undef';
+{
+ my $w;
+ local($SIG{__WARN__},$^W) = (sub { $w .= shift }, 1);
+ *x=<y>;
+ like $w, qr/^readline\(\) on unopened filehandle y at .*\n(?x:
+ )Undefined value assigned to typeglob at .*\n\z/,
+ '[perl #123790] *x=<y> used to fail an assertion';
+}
+
__DATA__
moo
moo