File tree 3 files changed +31
-1
lines changed
3 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,10 @@ PHP NEWS
2
2
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3
3
?? ??? 2013, PHP 5.3.23
4
4
5
+ - SPL:
6
+ . Fixed bug #64228 (RecursiveDirectoryIterator always assumes SKIP_DOTS).
7
+ (patch by kriss@krizalys.com, Laruence)
8
+
5
9
6
10
?? ??? 2013, PHP 5.3.22
7
11
Original file line number Diff line number Diff line change @@ -1431,6 +1431,7 @@ SPL_METHOD(FilesystemIterator, __construct)
1431
1431
SPL_METHOD (FilesystemIterator , rewind )
1432
1432
{
1433
1433
spl_filesystem_object * intern = (spl_filesystem_object * )zend_object_store_get_object (getThis () TSRMLS_CC );
1434
+ int skip_dots = SPL_HAS_FLAG (intern -> flags , SPL_FILE_DIR_SKIPDOTS );
1434
1435
1435
1436
if (zend_parse_parameters_none () == FAILURE ) {
1436
1437
return ;
@@ -1442,7 +1443,7 @@ SPL_METHOD(FilesystemIterator, rewind)
1442
1443
}
1443
1444
do {
1444
1445
spl_filesystem_dir_read (intern TSRMLS_CC );
1445
- } while (spl_filesystem_is_dot (intern -> u .dir .entry .d_name ));
1446
+ } while (skip_dots && spl_filesystem_is_dot (intern -> u .dir .entry .d_name ));
1446
1447
}
1447
1448
/* }}} */
1448
1449
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #64228 (RecursiveDirectoryIterator always assumes SKIP_DOTS)
3
+ --FILE--
4
+ <?php
5
+ $ dirs = array ();
6
+ $ empty_dir = __DIR__ . "/empty " ;
7
+ @mkdir ($ empty_dir );
8
+
9
+ $ i = new RecursiveDirectoryIterator ($ empty_dir , FilesystemIterator::KEY_AS_PATHNAME | FilesystemIterator::CURRENT_AS_FILEINFO ); // Note the absence of FilesystemIterator::SKIP_DOTS
10
+ foreach ($ i as $ key => $ value ) {
11
+ $ dirs [] = $ value ->getFileName ();
12
+ }
13
+
14
+ @rmdir ($ empty_dir );
15
+
16
+ sort ($ dirs );
17
+ print_r ($ dirs );
18
+ ?>
19
+ --EXPECT--
20
+ Array
21
+ (
22
+ [0] => .
23
+ [1] => ..
24
+ )
25
+
You can’t perform that action at this time.
0 commit comments