diff --git a/src/AutoRecord.php b/src/AutoRecord.php index 43ceff0..5c1f434 100644 --- a/src/AutoRecord.php +++ b/src/AutoRecord.php @@ -425,15 +425,15 @@ private function _getCommasAndEscapesPostgres($value, $type, $nullable, $default } } - if (strstr($type, 'text') && strlen($value) > 0) { + if (strstr($type, 'text') && strlen($value ?? '') > 0) { return "'" . $this->escape($value) . "'"; } - if (strstr($type, 'json') && strlen($value) > 0) { + if (strstr($type, 'json') && strlen($value ?? '') > 0) { return "'" . $this->escape($value) . "'"; } - if ($default && (strlen($value) > 0 || $value !== '')) { + if ($default && (strlen($value ?? '') > 0 || $value !== '')) { return $default; // here it contains the quotes already, :: deleted already }