Iterate over stream in a different way on PHP/HHVM

I'm unsure why they appear to work inconsistently, but they do. HHVM
parses the stream URL incorrectly with `DirectoryIterator` but not with
`scandir`. Moreover, it's rather worrying that PHP hangs with the `scandir`
implementation.