php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21921 opendir / readdir bug anytime
Submitted: 2003-01-28 09:09 UTC Modified: 2003-01-28 09:33 UTC
From: emmanuel dot leleu at delta-development dot fr Assigned:
Status: Not a bug Package: *Directory/Filesystem functions
PHP Version: 4.2.0 OS: ALL
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
50 + 50 = ?
Subscribe to this entry?

 
 [2003-01-28 09:09 UTC] emmanuel dot leleu at delta-development dot fr
PHP : all version
System : all system
--------------------
i find a "little problem" !
create a dir "testmanu"
inside create another dir named "titi" and another dir named "0" (zero)
( testmanu / titi , 0 )
and try to use opendir and readdir (recursif) for find inside any dir/file =bug ! Why ? because a dir is named "0" ! 

look and try :

<?php

// Emmanuel LELEU - emmanuel.leleu@delta-development.fr / manu@cyklades.com
// EL - fReadRecursif - v1.0 - 28/01/2003 16:02
function fReadRecursif($sPath)
{
	Global $sChemin;


	if (!$pListe = @opendir($sChemin.$sPath))
	echo "<br>fReadRecursif - chemin introuvable : $sPath";
	
	echo "<br>path in progress : ".$sChemin.$sPath;

	while ($sDir = @readdir($pListe))
	{
		echo "<br>found : ".$sDir;
		if ($sDir!= "." && $sDir != "..")
		{

			if (is_dir($sChemin.$sPath."/".$sDir))
			{
				
				fReadRecursif($sPath."/".$sDir);
			}		
		}
	}
	@closedir($pListe);
}

$sChemin = "./";
fReadRecursif("testmanu");
?>

manu

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-28 09:33 UTC] wez@php.net
Please read the manual for readdir() which explains how to deal with this.
http://php.net/readdir
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 11:01:27 2024 UTC