CodeIgniter Forums
directory_map function in directory helper skips directory with name "0" - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: directory_map function in directory helper skips directory with name "0" (/showthread.php?tid=45860)



directory_map function in directory helper skips directory with name "0" - El Forum - 10-09-2011

[eluser]Unknown[/eluser]
system/helpers/directory_helper.php:55 has code:
Code:
// Remove '.', '..', and hidden files [optional]
if ( ! trim($file, '.') OR ($hidden == FALSE && $file[0] == '.'))
{
continue;
}


If directory has the name exact "0", trim returns 0, and function skips this directory.
Thinking it is wrong, I found a fix:

Code:
if (strlen(trim($file, '.'))==0 OR ($hidden == FALSE && $file[0] == '.')) {
continue;
}
Please advice whether this is a bug and should this fix be promoted to CI codebase.

Regards, Irina