From a097563d29d2a1572776904bec7eab7100c6b585 Mon Sep 17 00:00:00 2001 From: Sam Hauglustaine Date: Wed, 11 Dec 2024 09:04:20 +0100 Subject: [PATCH 1/3] fix column with whitespace-only size spec --- src/Propel/Generator/Reverse/MysqlSchemaParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propel/Generator/Reverse/MysqlSchemaParser.php b/src/Propel/Generator/Reverse/MysqlSchemaParser.php index 0e1350739..c8c2b3de2 100644 --- a/src/Propel/Generator/Reverse/MysqlSchemaParser.php +++ b/src/Propel/Generator/Reverse/MysqlSchemaParser.php @@ -237,7 +237,7 @@ public function getColumnFromRow(array $row, Table $table): Column $/x'; if (preg_match($regexp, $row['Type'], $matches)) { $nativeType = $matches[1]; - if ($matches[2]) { + if (trim($matches[2])) { $cpos = strpos($matches[2], ','); if ($cpos !== false) { $size = (int)substr($matches[2], 0, $cpos); From 7a7b268a6e697a71d828fcfde719e0e9d9a35d39 Mon Sep 17 00:00:00 2001 From: Sam Hauglustaine Date: Wed, 11 Dec 2024 11:38:42 +0100 Subject: [PATCH 2/3] Revert "fix column with whitespace-only size spec" This reverts commit a097563d29d2a1572776904bec7eab7100c6b585. --- src/Propel/Generator/Reverse/MysqlSchemaParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propel/Generator/Reverse/MysqlSchemaParser.php b/src/Propel/Generator/Reverse/MysqlSchemaParser.php index c8c2b3de2..0e1350739 100644 --- a/src/Propel/Generator/Reverse/MysqlSchemaParser.php +++ b/src/Propel/Generator/Reverse/MysqlSchemaParser.php @@ -237,7 +237,7 @@ public function getColumnFromRow(array $row, Table $table): Column $/x'; if (preg_match($regexp, $row['Type'], $matches)) { $nativeType = $matches[1]; - if (trim($matches[2])) { + if ($matches[2]) { $cpos = strpos($matches[2], ','); if ($cpos !== false) { $size = (int)substr($matches[2], 0, $cpos); From 0c7fca26b52071188cda508baeac0780de4b2e80 Mon Sep 17 00:00:00 2001 From: Sam Hauglustaine Date: Wed, 11 Dec 2024 11:43:23 +0100 Subject: [PATCH 3/3] ignore false phpstan error --- src/Propel/Generator/Reverse/MysqlSchemaParser.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Propel/Generator/Reverse/MysqlSchemaParser.php b/src/Propel/Generator/Reverse/MysqlSchemaParser.php index 0e1350739..b80dfc5dd 100644 --- a/src/Propel/Generator/Reverse/MysqlSchemaParser.php +++ b/src/Propel/Generator/Reverse/MysqlSchemaParser.php @@ -237,7 +237,7 @@ public function getColumnFromRow(array $row, Table $table): Column $/x'; if (preg_match($regexp, $row['Type'], $matches)) { $nativeType = $matches[1]; - if ($matches[2]) { + if ($matches[2]) { // @phpstan-ignore if.alwaysTrue (see https://github.com/propelorm/Propel2/pull/2020#issuecomment-2535374330) $cpos = strpos($matches[2], ','); if ($cpos !== false) { $size = (int)substr($matches[2], 0, $cpos);