DbMigrationHook: Pad matching groups to the desired length before using them

This commit is contained in:
Yonas Habteab 2023-09-20 10:59:47 +02:00 committed by Johannes Meyer
parent e4c9266da2
commit c3eef5f607
1 changed files with 2 additions and 1 deletions

View File

@ -305,7 +305,8 @@ abstract class DbMigrationHook implements Countable
/** @var SplFileInfo $file */
foreach (new DirectoryIterator($path . DIRECTORY_SEPARATOR . $upgradeDir) as $file) {
if (preg_match('/^(v)?([^_]+)(?:_(\w+))?\.sql$/', $file->getFilename(), $m, PREG_UNMATCHED_AS_NULL)) {
[$_, $_, $migrateVersion, $description] = $m;
[$_, $_, $migrateVersion, $description] = array_pad($m, 4, null);
/** @var string $migrateVersion */
if ($migrateVersion && version_compare($migrateVersion, $version, '>')) {
$migration = new DbMigrationStep($migrateVersion, $file->getRealPath());
if (isset($descriptions[$migrateVersion])) {