diff --git a/Subscribers/DoctrineEncryptSubscriber.php b/Subscribers/DoctrineEncryptSubscriber.php index 2cca8b19..44dbfafd 100644 --- a/Subscribers/DoctrineEncryptSubscriber.php +++ b/Subscribers/DoctrineEncryptSubscriber.php @@ -266,7 +266,7 @@ public function processFields($entity, $isEncryptOperation = true) { $value = $pac->getValue($entity, $refProperty->getName()); if($encryptorMethod == "decrypt") { if(!is_null($value) and !empty($value)) { - if(substr($value, -5) == "") { + if(substr($value, -5) == $this->suffix) { $this->decryptCounter++; $currentPropValue = $this->encryptor->decrypt(substr($value, 0, -5)); $pac->setValue($entity, $refProperty->getName(), $currentPropValue); @@ -274,7 +274,7 @@ public function processFields($entity, $isEncryptOperation = true) { } } else { if(!is_null($value) and !empty($value)) { - if(substr($value, -5) != "") { + if(substr($value, -5) != $this->suffix) { $this->encryptCounter++; $currentPropValue = $this->encryptor->encrypt($value); $pac->setValue($entity, $refProperty->getName(), $currentPropValue);