|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2003-06-05 13:54 UTC] mrgibson at golum dot net
[2003-06-05 13:59 UTC] mrgibson at golum dot net
[2003-06-05 14:03 UTC] philip@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 01:00:01 2025 UTC |
Im running the code as a CLI application, i don't know if the bug persist with the PHP module or CGI. This is a little script that show the problem: <?php function recurse_search($dir,$pattern) { stdout_write("Recurse_search $dir,$pattern"); $temp = ""; $len = strlen($pattern); $d = @opendir($dir); if (!$d) die("Directory $dir not mounted or unavailable"); clearstatcache(); while($file = readdir($d)) { if ($temp != "") break; if ($file[0]==".") continue; if ($file[0]=="#") continue; stdout_write($file); if (is_dir($dir.$file."/")) { stdout_write("DIR : $file"); $bof = recurse_search($dir.$file."/",$pattern); } else if (substr($file,0,$len)==$pattern) { close($d); die($dir.$file); return $dir.$file; } } closedir($d); return $temp; } } function stdout_write($content) { $fp = fopen("php://stdout","w"); fwrite($content."\r\n"); fclose($fp); } print recurse_search("c:\\","system.ini"); ?> ---------------------------------------------------- When i get back from a prior directory recursion, the $file = readdir($d) stop working and the function exit.