Bug 239315

Summary: mod_perl do NOT handle lexical scope correctly.
Product: Red Hat Enterprise Linux 4 Reporter: Klaus Ethgen <Klaus+rhbz>
Component: mod_perlAssignee: Joe Orton <jorton>
Status: CLOSED DUPLICATE QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 4.5   
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2007-05-15 13:36:02 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Klaus Ethgen 2007-05-07 15:02:50 UTC
Description of problem:
mod_perl do NOT handle lexical scope correctly. (See the script below.)

Version-Release number of selected component (if applicable):
1.99_16-4

Steps to Reproduce:
1. Set up a http server
2. Configure it to execute the following script with mod_perl
3. Load (force) the following script _several times_ with a browser

--- script begin ---
#! /usr/bin/perl

sub test1
{
   my $test = join "", map {('a' .. 'z')[int(rand(26))]} (1 .. 6);

   sub _test2
   {
      my $par = shift;

      if ($par eq $test)
      {
         print <<"EOF";
Content-Type: text/plain

Variables identical: $test
EOF
      }
      else
      {
         print <<"EOF";
Content-Type: text/plain

Variables NOT identical: $par != $test
EOF
      } # if ($par eq $test) { ... } els...
   } # _test2

   _test2($test);
} # test1

test1;
--- script end ---
  
Actual results:
Several times: "Variables identical: dfhkdf"
Then most time: "Variables NOT identical: uskeoy != crmcsm"

Expected results:
Always "Variables identical: dfhkdf"

Additional info:
As you can see in the test script there is a function defined in the logical 
scope of a other function (block).

Comment 1 Joe Orton 2007-05-15 13:36:02 UTC

*** This bug has been marked as a duplicate of 239314 ***