Skip to content

Issue-60742: Added FilesystemIterator::OTHER_MODE_MASK #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ext/spl/spl_directory.c
Original file line number Diff line number Diff line change
@@ -3020,6 +3020,7 @@ PHP_MINIT_FUNCTION(spl_directory)
REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "FOLLOW_SYMLINKS", SPL_FILE_DIR_FOLLOW_SYMLINKS);
REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "KEY_AS_FILENAME", SPL_FILE_DIR_KEY_AS_FILENAME);
REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "NEW_CURRENT_AND_KEY", SPL_FILE_DIR_KEY_AS_FILENAME|SPL_FILE_DIR_CURRENT_AS_FILEINFO);
REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "OTHER_MODE_MASK", SPL_FILE_DIR_OTHERS_MASK);
REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "SKIP_DOTS", SPL_FILE_DIR_SKIPDOTS);
REGISTER_SPL_CLASS_CONST_LONG(FilesystemIterator, "UNIX_PATHS", SPL_FILE_DIR_UNIXPATHS);

40 changes: 40 additions & 0 deletions ext/spl/tests/filesystemiterator_flags.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
--TEST--
SPL: FilesystemIterator::getFlags() basic tests
--CREDITS--
Joshua Thijssen <jthijssen@noxlogic.nl>
--FILE--
<?php

$it = new FileSystemIterator(".");
printflags($it);

$it->setFlags(FileSystemIterator::CURRENT_AS_SELF |
FileSystemIterator::KEY_AS_FILENAME |
FileSystemIterator::SKIP_DOTS |
FileSystemIterator::UNIX_PATHS);
printflags($it);

$it->setFlags(-1);
printflags($it);

function printflags($it) {
printf("%08X\n", $it->getFlags());
printf("%08X\n", ($it->getFlags() & FileSystemIterator::CURRENT_MODE_MASK));
printf("%08X\n", ($it->getFlags() & FileSystemIterator::KEY_MODE_MASK));
printf("%08X\n", ($it->getFlags() & FileSystemIterator::OTHER_MODE_MASK));
}

?>
--EXPECT--
00001000
00000000
00000000
00001000
00003110
00000010
00000100
00003000
00003FF0
000000F0
00000F00
00003000