From: Michael G. Schwern <schwern@pobox.com>
Date: Thu, 9 Dec 2004 22:11:59 +0000 (-0500)
Subject: Test rt.perl.org 5900
X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=65814f212804b54d640757f2e2db70ecb1e8440c;p=p5sagit%2Fp5-mst-13.2.git

Test rt.perl.org 5900
Message-ID: <20041210031159.GA7629@windhund.schwern.org>

p4raw-id: //depot/perl@23636
---

diff --git a/t/op/taint.t b/t/op/taint.t
index cd445e4..69af31e 100755
--- a/t/op/taint.t
+++ b/t/op/taint.t
@@ -17,7 +17,7 @@ use Config;
 use File::Spec::Functions;
 
 BEGIN { require './test.pl'; }
-plan tests => 236;
+plan tests => 238;
 
 
 $| = 1;
@@ -1068,3 +1068,24 @@ TERNARY_CONDITIONALS: {
     test $result eq "The Fabulous Johnny Cash";
     test !tainted( $result );
 }
+
+{
+    # rt.perl.org 5900  $1 remains tainted if...
+    # 1) The regular expression contains a scalar variable AND
+    # 2) The regular expression appears in an elsif clause
+
+    my $foo = "abcdefghi" . $TAINT;
+
+    my $valid_chars = 'a-z';
+    if ( $foo eq '' ) {
+    }
+    elsif ( $foo =~ /([$valid_chars]+)/o ) {
+        test not tainted $1;
+    }
+
+    if ( $foo eq '' ) {
+    }
+    elsif ( my @bar = $foo =~ /([$valid_chars]+)/o ) {
+        test not any_tainted @bar;
+    }
+}