summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-09-14 10:40:43 +0200
committerAndrey Andreev <narf@bofh.bg>2012-09-14 10:40:43 +0200
commitcd0b93be53c9c4e8d4c993a3ee230f8b0fa84c65 (patch)
treeacf12caef85efb9ca6152702d80b294a0d254a79
parenta82e6a6675dc0763f10541641c87caf416aa8add (diff)
parent8280885499ca4b1cffacc9ad78a9eff07a84de25 (diff)
Merge pull request #1794 from vlakoff/develop-2
directory_map() was skipping files and directories named "0"
-rw-r--r--system/helpers/directory_helper.php2
-rw-r--r--tests/codeigniter/helpers/directory_helper_test.php4
-rw-r--r--user_guide_src/source/changelog.rst1
3 files changed, 5 insertions, 2 deletions
diff --git a/system/helpers/directory_helper.php b/system/helpers/directory_helper.php
index e7d3b5e8a..7d6b6770e 100644
--- a/system/helpers/directory_helper.php
+++ b/system/helpers/directory_helper.php
@@ -62,7 +62,7 @@ if ( ! function_exists('directory_map'))
while (FALSE !== ($file = readdir($fp)))
{
// Remove '.', '..', and hidden files [optional]
- if ( ! trim($file, '.') OR ($hidden === FALSE && $file[0] === '.'))
+ if ($file === '.' OR $file === '..' OR ($hidden === FALSE && $file[0] === '.'))
{
continue;
}
diff --git a/tests/codeigniter/helpers/directory_helper_test.php b/tests/codeigniter/helpers/directory_helper_test.php
index 176ff1d78..c39ccd8d0 100644
--- a/tests/codeigniter/helpers/directory_helper_test.php
+++ b/tests/codeigniter/helpers/directory_helper_test.php
@@ -19,6 +19,7 @@ class Directory_helper_test extends CI_TestCase {
'benchmark.html' => '',
'database' => array('active_record.html' => '', 'binds.html' => ''),
'email.html' => '',
+ '0' => '',
'.hiddenfile.txt' => ''
)
);
@@ -30,7 +31,8 @@ class Directory_helper_test extends CI_TestCase {
'libraries' => array(
'benchmark.html',
'database' => array('active_record.html', 'binds.html'),
- 'email.html'
+ 'email.html',
+ '0'
)
);
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 481afeee3..66dd0ea05 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -341,6 +341,7 @@ Bug fixes for 3.0
- Fixed a bug (#1605) - :doc:`Pagination Library <libraries/pagination>` produced incorrect *previous* and *next* link values.
- Fixed a bug in SQLSRV's ``affected_rows()`` method where an erroneous function name was used.
- Fixed a bug (#1000) - Change syntax of ``$view_file`` to ``$_ci_view_file`` to prevent being overwritten by application.
+- Fixed a bug (#1757) - :doc:`Directory Helper <helpers/directory_helper>` function ``directory_map()`` was skipping files and directories named *0*.
Version 2.1.2
=============