File tree 3 files changed +22
-1
lines changed
3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,8 @@ PHP NEWS
76
76
. Fixed bug #62025 (__ss_family was changed on AIX 5.3). (Felipe)
77
77
78
78
- SPL:
79
+ . Fixed bug #62433 (Inconsistent behavior of RecursiveDirectoryIterator to
80
+ dot files). (Laruence)
79
81
. Fixed bug #62262 (RecursiveArrayIterator does not implement Countable).
80
82
(Nikita Popov)
81
83
Original file line number Diff line number Diff line change @@ -1432,6 +1432,7 @@ SPL_METHOD(FilesystemIterator, __construct)
1432
1432
SPL_METHOD (FilesystemIterator , rewind )
1433
1433
{
1434
1434
spl_filesystem_object * intern = (spl_filesystem_object * )zend_object_store_get_object (getThis () TSRMLS_CC );
1435
+ int skip_dots = SPL_HAS_FLAG (intern -> flags , SPL_FILE_DIR_SKIPDOTS );
1435
1436
1436
1437
if (zend_parse_parameters_none () == FAILURE ) {
1437
1438
return ;
@@ -1443,7 +1444,7 @@ SPL_METHOD(FilesystemIterator, rewind)
1443
1444
}
1444
1445
do {
1445
1446
spl_filesystem_dir_read (intern TSRMLS_CC );
1446
- } while (spl_filesystem_is_dot (intern -> u .dir .entry .d_name ));
1447
+ } while (skip_dots && spl_filesystem_is_dot (intern -> u .dir .entry .d_name ));
1447
1448
}
1448
1449
/* }}} */
1449
1450
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #62433 Inconsistent behavior of RecursiveDirectoryIterator to dot files (. and ..)
3
+ --FILE--
4
+ <?php
5
+ $ dots = array_keys (iterator_to_array (new RecursiveDirectoryIterator (__DIR__ )));
6
+ $ ndots = array_keys (iterator_to_array (new RecursiveDirectoryIterator (__DIR__ , FilesystemIterator::SKIP_DOTS )));
7
+
8
+ var_dump (in_array (__DIR__ . '/. ' , $ dots ));
9
+ var_dump (in_array (__DIR__ . '/.. ' , $ dots ));
10
+
11
+ var_dump (in_array (__DIR__ . '/. ' , $ ndots ));
12
+ var_dump (in_array (__DIR__ . '/.. ' , $ ndots ));
13
+ ?>
14
+ --EXPECT--
15
+ bool(true)
16
+ bool(true)
17
+ bool(false)
18
+ bool(false)
You can’t perform that action at this time.
0 commit comments