Skip to content
Snippets Groups Projects

Draft: Issue #3302838: Querying with NULL values results in warning mb_strtolower(): Passing null to parameter is deprecated

Open Draft: Issue #3302838: Querying with NULL values results in warning mb_strtolower(): Passing null to parameter is deprecated
Open Joe Parsons requested to merge issue/drupal-3302838:3302838-fix-config-entity-base into 11.x
Files
2
@@ -306,12 +306,14 @@ public function preSave(EntityStorageInterface $storage) {
// Ensure this entity's UUID does not exist with a different ID, regardless
// of whether it's new or updated.
$matching_entities = $storage->getQuery()
->condition('uuid', $this->uuid())
->execute();
$matched_entity = reset($matching_entities);
if (!empty($matched_entity) && ($matched_entity != $this->id()) && $matched_entity != $this->getOriginalId()) {
throw new ConfigDuplicateUUIDException("Attempt to save a configuration entity '{$this->id()}' with UUID '{$this->uuid()}' when this UUID is already used for '$matched_entity'");
if ($this->uuid() !== NULL) {
$matching_entities = $storage->getQuery()
->condition('uuid', $this->uuid())
->execute();
$matched_entity = reset($matching_entities);
if (!empty($matched_entity) && ($matched_entity != $this->id()) && $matched_entity != $this->getOriginalId()) {
throw new ConfigDuplicateUUIDException("Attempt to save a configuration entity '{$this->id()}' with UUID '{$this->uuid()}' when this UUID is already used for '$matched_entity'");
}
}
// If this entity is not new, load the original entity for comparison.
Loading