diff options
author | Derek Jones <derek.jones@ellislab.com> | 2008-05-06 16:12:18 +0200 |
---|---|---|
committer | Derek Jones <derek.jones@ellislab.com> | 2008-05-06 16:12:18 +0200 |
commit | 2798b5033815f9165ad10137c0866b5fdb59ea54 (patch) | |
tree | 636308611e29de880c2c5e7caf7f368a245593cd | |
parent | de7320bb78f02baa3b7cad3983d5b6d3a9c74f34 (diff) |
fixed a bug where the dir resource was not closed in the directory helper, and made it more efficient
http://codeigniter.com/bug_tracker/bug/4206/
-rw-r--r-- | system/helpers/directory_helper.php | 15 | ||||
-rw-r--r-- | user_guide/changelog.html | 1 |
2 files changed, 13 insertions, 3 deletions
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php index 5a23944cb..25c16c1fc 100644 --- a/system/helpers/directory_helper.php +++ b/system/helpers/directory_helper.php @@ -45,22 +45,31 @@ if (! function_exists('directory_map')) {
if ($fp = @opendir($source_dir))
{
+ $source_dir = rtrim($source_dir, DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR;
$filedata = array();
+
while (FALSE !== ($file = readdir($fp)))
{
- if (@is_dir($source_dir.$file) && substr($file, 0, 1) != '.' AND $top_level_only == FALSE)
+ if (substr($file, 0, 1) == '.')
+ {
+ continue;
+ }
+
+ if ($top_level_only == FALSE && @is_dir($source_dir.$file))
{
$temp_array = array();
- $temp_array = directory_map($source_dir.$file."/");
+ $temp_array = directory_map($source_dir.$file.DIRECTORY_SEPARATOR);
$filedata[$file] = $temp_array;
}
- elseif (substr($file, 0, 1) != ".")
+ else
{
$filedata[] = $file;
}
}
+
+ closedir($fp);
return $filedata;
}
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index fec2d12c3..2242f86e9 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -120,6 +120,7 @@ SVN Commit: not currently released</p> <li>Fixed a bug in <kbd>link_tag()</kbd> of the <a href="helpers/url_helper.html">URL helper</a> where a key was passed instead of a value.</li>
<li>Fixed a bug in DB_result::row() that prevented it from returning individual fields with MySQL NULL values.</li>
<li>Fixed a bug in the table library that could cause identically constructed rows to be dropped (#3459).</li>
+ <li>Fixed a bug (#4206) in the Directory Helper where the directory resource was not being closed, and minor improvements.</li>
</ul>
<h2>Version 1.6.1</h2>
|