summaryrefslogtreecommitdiff
path: root/t/op
diff options
context:
space:
mode:
authorYves Orton <demerphq@gmail.com>2022-11-01 16:40:37 +0100
committerYves Orton <demerphq@gmail.com>2022-11-01 21:17:44 +0100
commitcb4eaf3cc6e921efca96ee9abe9b02e07b4259ee (patch)
tree7148ec8136891fd75e27b5dcac3ee715fa12d4a8 /t/op
parentd72e07fc940ee748cb83237a6e5339187e754f5d (diff)
downloadperl-cb4eaf3cc6e921efca96ee9abe9b02e07b4259ee.tar.gz
pp_ctl.c - teach module_true how to deal with blocked requires
If require encounters an @INC hook that blocks the require it ends up with a STUB node as the optree for the LEAVEEVAL. This was causing the module_true logic to segfault. Guarding against the OP_STUB node fixes the problem. This affected the tests for IO::Socket::SSL. Thanks to Graham Knopp for the reduced case, and James Keenan for reporting it in https://github.com/Perl/perl5/issues/20468. This should fix the problem.
Diffstat (limited to 't/op')
-rw-r--r--t/op/require_errors.t9
1 files changed, 8 insertions, 1 deletions
diff --git a/t/op/require_errors.t b/t/op/require_errors.t
index f80aebd422..1e86fbb719 100644
--- a/t/op/require_errors.t
+++ b/t/op/require_errors.t
@@ -9,7 +9,7 @@ BEGIN {
use strict;
use warnings;
-plan(tests => 57);
+plan(tests => 58);
my $nonfile = tempfile();
@@ -283,3 +283,10 @@ like $@, qr/^Can't locate \Q$nonsearch\E at/,
"check the second attempt also fails");
like $@, qr/Attempt to reload/, "check we failed for the right reason";
}
+
+{
+ fresh_perl_like(
+ 'unshift @INC, sub { sub { 0 } }; require "asdasd";',
+ qr/asdasd did not return a true value/,
+ { }, '@INC hook blocks do not cause segfault');
+}