From be4053cea0462c9de5396641f4e4fa2f56f5a675 Mon Sep 17 00:00:00 2001 From: Xinchen Hui Date: Mon, 2 Jul 2012 11:33:38 +0800 Subject: Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to dot files). --- NEWS | 2 ++ ext/spl/spl_directory.c | 3 ++- ext/spl/tests/bug62433.phpt | 18 ++++++++++++++++++ 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 ext/spl/tests/bug62433.phpt diff --git a/NEWS b/NEWS index 6dd1feb777..70a8eb9ec0 100644 --- a/NEWS +++ b/NEWS @@ -76,6 +76,8 @@ PHP NEWS . Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe) - SPL: + . Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to + dot files). (Laruence) . Fixed bug #62262 (RecursiveArrayIterator does not implement Countable). (Nikita Popov) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index dbae3e2a09..0fcbd317e3 100755 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1432,6 +1432,7 @@ SPL_METHOD(FilesystemIterator, __construct) SPL_METHOD(FilesystemIterator, rewind) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); + int skip_dots = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_SKIPDOTS); if (zend_parse_parameters_none() == FAILURE) { return; @@ -1443,7 +1444,7 @@ SPL_METHOD(FilesystemIterator, rewind) } do { spl_filesystem_dir_read(intern TSRMLS_CC); - } while (spl_filesystem_is_dot(intern->u.dir.entry.d_name)); + } while (skip_dots && spl_filesystem_is_dot(intern->u.dir.entry.d_name)); } /* }}} */ diff --git a/ext/spl/tests/bug62433.phpt b/ext/spl/tests/bug62433.phpt new file mode 100644 index 0000000000..86b5df8387 --- /dev/null +++ b/ext/spl/tests/bug62433.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #62433 Inconsistent behavior of RecursiveDirectoryIterator to dot files (. and ..) +--FILE-- + +--EXPECT-- +bool(true) +bool(true) +bool(false) +bool(false) -- cgit v1.2.1