PHP 4.0 Bug #5242: wrong variable value in recoursive functions declared as object method

From: Date: Wed, 28 Jun 2000 11:56:54 +0000
Subject: PHP 4.0 Bug #5242: wrong variable value in recoursive functions declared as object method
Groups: php.dev 
Request: Send a blank email to php-dev+get-22458@lists.php.net to get a copy of this message
From: marco@gsol.it Operating system: RH Linux 6.1 - apache 1.3.12 PHP version: 4.0.0 Release PHP Bug Type: Scripting Engine problem Bug description: wrong variable value in recoursive functions declared as object method <?php class Menu { function printfield($Active, $Level, $Value, $Link) { [...] } function printchilds($Parents, $Active=0, $Level=0, $Parent=0) { $name=$this->that_class; $q = new $name; $q->query('select ID,Expand,Value,Link from ' . $this->table . ' where GID=' . $Parent . ' and En=1 order by Sort'); while($q->next_record()) { $ID=$q->f(0); $Expand=intval($q->f(1)); $Value=htmlentities($q->f(2)); $Link=$q->f(3); $this->printfield($Active==$ID, $Level, $Value, $Link); if (!$Expand) { if ($ID==$Active) $Expand=true; else for ($i=0;isset($Parents[$i]);++$i) $Expand=$Expand || ($Parents[$i]==$ID); } if ($Expand) $this->printchilds($Parents, $Active, $Level+1, $ID); # Recoursive call } } } ?> $Parent variable assumes other variables values instead $ID value

« previous php.dev (#22458) next »