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
 [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-2019 The PHP Group
All rights reserved.
Last updated: Sun May 19 16:01:26 2019 UTC