This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Test that caller does not SEGV when the current package is undefined.
authorNicholas Clark <nick@ccl4.org>
Fri, 5 Apr 2013 10:12:53 +0000 (12:12 +0200)
committerNicholas Clark <nick@ccl4.org>
Tue, 21 May 2013 09:34:44 +0000 (11:34 +0200)
Prior to commit d4d03940c58a0177 this code would SEGV under ithreads.
Test suggested by Brian Fraser.

t/op/caller.t

index efce8df..c37a6ed 100644 (file)
@@ -5,7 +5,7 @@ BEGIN {
     chdir 't' if -d 't';
     @INC = '../lib';
     require './test.pl';
-    plan( tests => 91 );
+    plan( tests => 92 );
 }
 
 my @c;
@@ -297,6 +297,14 @@ is eval "s//<<END/e;\nfoo\nEND\n(caller 0)[6]",
  is $w, 1, 'value from (caller 0)[9] (bitmask) works in ${^WARNING_BITS}';
 }
 
+# This was fixed with commit d4d03940c58a0177, which fixed bug #78742
+fresh_perl_is <<'END', "__ANON__::doof\n", {},
+package foo;
+BEGIN {undef %foo::}
+sub doof { caller(0) }
+print +(doof())[3];
+END
+    "caller should not SEGV when the current package is undefined";
 $::testing_caller = 1;
 
 do './op/caller.pl' or die $@;