php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22096 return inside a while loop isn't breaking the loop and returning a value
Submitted: 2003-02-06 15:09 UTC Modified: 2003-02-20 08:08 UTC
Votes:7
Avg. Score:3.9 ± 1.5
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: enygma at phpdeveloper dot org Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 4.2.2 OS: RedHat Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: enygma at phpdeveloper dot org
New email:
PHP Version: OS:

 

 [2003-02-06 15:09 UTC] enygma at phpdeveloper dot 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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-02-09 10:56 UTC] moriyoshi@php.net
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.



 [2003-02-20 08:08 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


And the latest PHP version is 4.3.1 nowadays..

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 13:01:30 2024 UTC