1
0
mirror of https://github.com/dg/dibi.git synced 2025-02-22 18:02:25 +01: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,
];
}