1
0
mirror of https://github.com/dg/dibi.git synced 2025-08-11 16:44:30 +02:00

fix TypeError: substr() expects parameter 1 to be string, null given (#306)

This commit is contained in:
Jan Kuchař
2018-08-22 12:08:35 +02:00
committed by David Grudl
parent 15df96bb22
commit 4abe874ce9

View File

@@ -130,7 +130,7 @@ class PostgreReflector implements Dibi\Reflector
'size' => $size > 0 ? $size : null,
'nullable' => $row['is_nullable'] === 'YES' || $row['is_nullable'] === 't' || $row['is_nullable'] === true,
'default' => $row['column_default'],
'autoincrement' => (int) $row['ordinal_position'] === $primary && substr($row['column_default'], 0, 7) === 'nextval',
'autoincrement' => (int) $row['ordinal_position'] === $primary && substr($row['column_default'] ?? '', 0, 7) === 'nextval',
'vendor' => $row,
];
}