Don't automatically rewind DirectoryScanner file handle #768
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
When running the DirectoryScanner ETL DataEndpoint in docker using the latest overlay2 storage driver and PHP 5.4, the
DirectoryScannerTest::testPatternFilters()
automated tests would fail because an incorrect number of files (exactly 2 times the expected number) was returned from a directory scan. When using the aufs driver (as shippable.com does) this did not manifest.The error occurs when the
CallbackFilterIterator::rewind()
method is called twice in a row. The set of records returned by the iterator is duplicated. Since we iterate over the set usingforeach
and arewind()
is called under the hood by PHP it is not necessary to explicitly call it ourselves.Note that this bug does not manifest in PHP7 running in docker.
Motivation and Context
Rescue developers from insanity wondering why tests that have been working for years are now failing.
Tests performed
Manual docker testing and automated testing in docker.
Types of changes
Checklist: