From 142a624df2f48858467de67a4542d77807cc968b Mon Sep 17 00:00:00 2001 From: George Wilson Date: Mon, 10 Jan 2022 02:28:52 +0000 Subject: [PATCH] Fix order of checks --- src/Pgsql/PgsqlDriver.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Pgsql/PgsqlDriver.php b/src/Pgsql/PgsqlDriver.php index 12717a5eb..b9767b7b9 100644 --- a/src/Pgsql/PgsqlDriver.php +++ b/src/Pgsql/PgsqlDriver.php @@ -271,17 +271,17 @@ public function getTableColumns($table, $typeOnly = true) { if ($field->Default !== null) { - // Change Postgresql's NULL::* type with PHP's null one - if (preg_match('/^NULL::*/', $field->Default)) - { - $field->Default = null; - } - // Normalise default values like datetime if (preg_match('/^\'(.*)\'::.*/', $field->Default, $matches)) { $field->Default = $matches[1]; } + + // Change Postgresql's NULL::* type with PHP's null one. Do this last to avoid PHP type issues in PHP 8.1 and up + if (preg_match('/^NULL::*/', $field->Default)) + { + $field->Default = null; + } } // Do some dirty translation to MySQL output.