Skip to content

Commit

Permalink
don't assign value unless needed by null
Browse files Browse the repository at this point in the history
  • Loading branch information
lekoala committed Sep 19, 2024
1 parent 1b8ac8d commit 43f66e3
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/EncryptedDBField.php
Original file line number Diff line number Diff line change
Expand Up @@ -377,16 +377,12 @@ public function setValue($value, $record = null, $markChanged = true)
throw new Exception("Unexcepted value of type " . gettype($value));
}

if (!is_scalar($value)) {
$value = $this->value;
}

// Forward changes otherwise old value may get restored from record
// Can also help if manipulations are not executed properly
$this->setValueField($value, $markChanged);
if (!$this->value) {
// Forward changes otherwise old value may get restored from record
// Can also help if manipulations are not executed properly
$this->setValueField(null, $markChanged);

// Make sure blind index gets nullified
if (!$value) {
// Make sure blind index gets nullified
$this->setBlindIndexField(null);
}

Expand Down

0 comments on commit 43f66e3

Please sign in to comment.