sachavdk Posted January 19, 2007 Share Posted January 19, 2007 Hi,I'm trying to write a function that loops through a folder I specify,if a specific file is also a folder, the function itself is called again with the new directory path,it loops through this one, ...But the error I get is:[b]The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:[/b](No headers are sent with it).Here's the function (var $tpls is not used yet but I don't think that'll be the problem):[b]$tpls = "";$dir = "styles/main/tpl/";function loopDirs($dir, $tpls) { if (is_dir($dir)) { if ($dh = opendir($dir)) { while (($file = readdir($dh)) !== false) { if (is_dir($dir . "/" . $file . "/")) { loopDirs($dir . "/" . $file . "/", $tpls); } else { echo $dir . "/" . $file."<br />"; } } closedir($dh); } }}loopDirs($dir, $tpls);[/b] Link to comment https://forums.phpfreaks.com/topic/34933-self-nested-function-returns-cgi-error/ Share on other sites More sharing options...
sachavdk Posted January 19, 2007 Author Share Posted January 19, 2007 Sorry for posting that quick, I had to search better.The error is caused because I don't check for . and ..So it gets in an never ending loop.Maybe something to check for people who have the same prob. :P ;D Link to comment https://forums.phpfreaks.com/topic/34933-self-nested-function-returns-cgi-error/#findComment-164742 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.