From 454238f901234d31152393f5cee6b7dfc708e9be Mon Sep 17 00:00:00 2001 From: styks1987 Date: Mon, 20 Nov 2017 08:03:36 -0500 Subject: [PATCH] ensure unique file names are returned (#1239) * 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 --- src/Phinx/Migration/Manager.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Phinx/Migration/Manager.php b/src/Phinx/Migration/Manager.php index d7405c226..3a2414611 100644 --- a/src/Phinx/Migration/Manager.php +++ b/src/Phinx/Migration/Manager.php @@ -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; } @@ -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; }