fixed DateComparator if file does not exist

Description:
When a file is deleted after the iterator is created, the accept function throws the following exception: SplFileInfo::getMTime(): stat failed.  This is because the function doesn't check first for the existence of the file.  In theory, a deletion between existence being checked and getMTime getting called would still result in this error, but the risk area for this race condition is much smaller than the current risk area.

| Q             | A
| ------------ | ----
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets | #11785
| License | MIT
| Doc PR | 

I ran an additional benchmark at the time by doing a scandir on my /usr/bin
folder and randomly selecting file names from that array.  That increased
the cost of 10000 calls from 0.01 seconds to 0.015 seconds, and that
includes the cost of random number generation, so the cost per call is
still negligible.

I agree that this is less than ideal, but remember that the code initially
had a call to $fileinfo->isFile(), which probably had a higher performance
hit and was only removed because of improper directory handling.
On Aug 31, 2014 4:17 PM, "Markus Staab" <notifications@github.com> wrote:

> In src/Symfony/Component/Finder/Iterator/DateRangeFilterIterator.php:
>
> > @@ -44,6 +44,10 @@ public function accept()
> >      {
> >          $fileinfo = $this->current();
> >
> > +        if (!file_exists($fileinfo->getRealPath())) {
>
> @fabpot <https://github.com/fabpot> @stof <https://github.com/stof>
> opinions?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/symfony/symfony/pull/11787/files#r16936737>.
>