Skip to content

Commit 205cc48

Browse files
committed
Merge pull request laravel#1356 from helmut/patch-1
Update laravel/file.php
2 parents 0a0eb37 + 1d725b2 commit 205cc48

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

laravel/file.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,8 @@ public static function cleandir($directory)
331331
*/
332332
public static function latest($directory, $options = fIterator::SKIP_DOTS)
333333
{
334+
$latest = null;
335+
334336
$time = 0;
335337

336338
$items = new fIterator($directory, $options);
@@ -340,7 +342,11 @@ public static function latest($directory, $options = fIterator::SKIP_DOTS)
340342
// with a UNIX timestamp greater than the latest one.
341343
foreach ($items as $item)
342344
{
343-
if ($item->getMTime() > $time) $latest = $item;
345+
if ($item->getMTime() > $time)
346+
{
347+
$latest = $item;
348+
$time = $item->getMTime();
349+
}
344350
}
345351

346352
return $latest;

0 commit comments

Comments
 (0)