Skip to content

Commit

Permalink
ensure unique file names are returned (#1239)
Browse files Browse the repository at this point in the history
* ensure unique file names are returned 

// glob() can return the same file multiple times
        // This will cause the migration to fail with a 
        // false assumption of duplicate migrations
        // http://php.net/manual/en/function.glob.php#110340

* fix spacing issue
  • Loading branch information
styks1987 authored and rquadling committed Nov 20, 2017
1 parent cc3543c commit 454238f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/Phinx/Migration/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,11 @@ protected function getMigrationFiles()
Util::glob($path . DIRECTORY_SEPARATOR . '*.php')
);
}
// glob() can return the same file multiple times
// This will cause the migration to fail with a
// false assumption of duplicate migrations
// http://php.net/manual/en/function.glob.php#110340
$files = array_unique($files);

return $files;
}
Expand Down Expand Up @@ -838,6 +843,11 @@ protected function getSeedFiles()
Util::glob($path . DIRECTORY_SEPARATOR . '*.php')
);
}
// glob() can return the same file multiple times
// This will cause the migration to fail with a
// false assumption of duplicate migrations
// http://php.net/manual/en/function.glob.php#110340
$files = array_unique($files);

return $files;
}
Expand Down

0 comments on commit 454238f

Please sign in to comment.