When using the option FilesystemIterator::FOLLOW_SYMLINKS if there is a symlink to an upper directory there is a loop so we end up with repeated directories.
For example (having a -> ../ ):
/c
/c/..
/c/a
/c/a/c
/c/a/c/..
/c/a/c/a
/c/a/c/a/c
... (up to 40 x /c/a )
/c/a/c/a/..
/c/a/c/a/.
/c/a/c/.
/c/a/..
/c/a/.
/c/.
/..
/.
Apparently there is a limit to avoid having an infinite loop. I don't know documentation for this.
It would be interesting to have an option to allow following symlinks without loops.