From:             [EMAIL PROTECTED]
Operating system: RedHat Linux
PHP version:      4.2.2
PHP Bug Type:     *General Issues
Bug description:  return inside a while loop isn't breaking the loop and returning a 
value

Here's the code I'm working with:

function getFilePath($filename,$path=''){
                if(empty($path)){ $path=$this->basedir; }
                echo $path."<br>";
                if($dir=@opendir($path)){
                        while(false!==($file=readdir($dir))){
                                if(!in_array($file,$this->remove_array)){
                                        $file_path=$path."/".$file;
                                        if(is_file($file_path)){
                                                
if(strtolower($file)==strtolower($filename)){
                                                        $this->found_path=$file_path;
                                                        return $file_path;
                                                }
                                        }elseif(is_dir($file_path)){
                                                
$this->getFilePath($filename,$file_path);
                                        }
                                }
                        }
                }
                closedir($dir);
                //return $this->found_path;
        }

Where it starts in one dir, and goes until it finds a file - then, when it
does, it's supposed to return that path value - but it doesn't. It keeps
going through the rest of the directories without stopping at the "return"
-- 
Edit bug report at http://bugs.php.net/?id=22096&edit=1
-- 
Try a CVS snapshot:         http://bugs.php.net/fix.php?id=22096&r=trysnapshot
Fixed in CVS:               http://bugs.php.net/fix.php?id=22096&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=22096&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=22096&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=22096&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=22096&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=22096&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=22096&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=22096&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=22096&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=22096&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=22096&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=22096&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=22096&r=gnused

Reply via email to