Skip to content

Commit

Permalink
fix strlen
Browse files Browse the repository at this point in the history
  • Loading branch information
salvosav committed Mar 6, 2024
1 parent eec2e1a commit 5675656
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/AutoRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 5675656

Please sign in to comment.