Class SymlinkLoopFilterIterator
Prevents descending into symbolic links that would cause an infinite loop.
When symbolic links are followed, a link pointing to one of the directories currently being traversed (for example, a link to its own parent) would be descended into forever. This iterator keeps track of the directories from the root down to the current one and refuses to descend into a link whose target is already part of that chain.
The link itself is still returned as an entry.
Property Summary
-
$visited protected
array<string>Identities (device and inode) of the directories from the root down to the current one.
Method Summary
-
__construct() public
Wraps a directory iterator and records the ancestor directory identities.
-
accept() public
-
getChildren() public
-
hasChildren() public
Method Detail
__construct() ¶ public
__construct(RecursiveDirectoryIterator $iterator, array<string> $ancestors = [])
Wraps a directory iterator and records the ancestor directory identities.
Parameters
-
RecursiveDirectoryIterator$iterator The iterator to wrap
-
array<string>$ancestors optional Identities of the directories above the one being iterated
Property Detail
$visited ¶ protected
Identities (device and inode) of the directories from the root down to the current one.
Type
array<string>