summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2008-03-27 17:07:00 +0100
committerDerek Jones <derek.jones@ellislab.com>2008-03-27 17:07:00 +0100
commit560efb353a1395f51a170f32b974c2afb897a712 (patch)
treed9a80be027a9ff9c08b4c27971c06525806ff056
parent0bb0e50151ce7f46b40d8e905888279b3728f72f (diff)
Fixed bug #4350 in get_filenames() when the $source_dir does not include a trailing slash
-rw-r--r--system/helpers/file_helper.php8
-rw-r--r--user_guide/changelog.html2
2 files changed, 7 insertions, 3 deletions
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 1b37af2fd..7eb93dab2 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -160,19 +160,23 @@ if (! function_exists('delete_files'))
* @access public
* @param string path to source
* @param bool whether to include the path as part of the filename
+ * @param bool internal variable to determine recursion status - do not use in calls
* @return array
*/
if (! function_exists('get_filenames'))
{
- function get_filenames($source_dir, $include_path = FALSE, $recursion = FALSE)
+ function get_filenames($source_dir, $include_path = FALSE, $_recursion = FALSE)
{
static $_filedata = array();
- if ($recursion === FALSE)
+ // reset the array and make sure $source_dir has a trailing slash on the initial call
+ if ($_recursion === FALSE)
{
$_filedata = array();
+ $source_dir = realpath($source_dir).'/';
}
+
if ($fp = @opendir($source_dir))
{
while (FALSE !== ($file = readdir($fp)))
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 230627abe..d70b449b5 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -92,7 +92,7 @@ Change Log
<li>Fixed an AR_caching error where it wasn't tracking table aliases (#3463).</li>
<li>Fixed a bug in the DB class testing the $params argument.</li>
<li>Fixed a bug in the Table library where the integer 0 in cell data would be displayed as a blank cell.</li>
- <li>Fixed a bug (#3523) in get_filenames() with recursion.</li>
+ <li>Fixed bugs (#3523, #4350) in get_filenames() with recursion.</p>
</ul>
<h2>Version 1.6.1</h2>