#22096 [Opn->Fbk]: return inside a while loop isn't breaking the loop and returning a value

From: Date: Sun, 09 Feb 2003 16:56:54 +0000
Subject: #22096 [Opn->Fbk]: return inside a while loop isn't breaking the loop and returning a value
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-32576@lists.php.net to get a copy of this message
ID: 22096 Updated by: moriyoshi@php.net Reported By: enygma@phpdeveloper.org -Status: Open +Status: Feedback Bug Type: *General Issues Operating System: RedHat Linux PHP Version: 4.2.2 New Comment: Not enough information was provided for us to be able to handle this bug. Please re-read the instructions at http://bugs.php.net/how-to-report.php If you can provide more information, feel free to add it to this bug and change the status back to "Open". Thank you for your interest in PHP. Previous Comments: ------------------------------------------------------------------------ [2003-02-06 15:09:30] enygma@phpdeveloper.org 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 this bug report at http://bugs.php.net/?id=22096&edit=1

« previous php.bugs (#32576) next »