Loading composer.lock +2 −2 Original line number Diff line number Diff line Loading @@ -9336,8 +9336,8 @@ }, "prefer-stable": true, "prefer-lowest": false, "platform": [], "platform-dev": [], "platform": {}, "platform-dev": {}, "platform-overrides": { "php": "8.3.0" }, Loading core/lib/Drupal/Core/Ajax/MessageCommand.php +7 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Drupal\Core\Ajax; use Drupal\Component\Render\MarkupInterface; use Drupal\Component\Utility\Xss; use Drupal\Core\Asset\AttachedAssets; /** Loading Loading @@ -68,7 +70,7 @@ class MessageCommand implements CommandInterface, CommandWithAttachedAssetsInter /** * The message text. * * @var string * @var string|\Drupal\Component\Render\MarkupInterface */ protected $message; Loading Loading @@ -96,7 +98,7 @@ class MessageCommand implements CommandInterface, CommandWithAttachedAssetsInter /** * Constructs a MessageCommand object. * * @param string $message * @param string|\Drupal\Component\Render\MarkupInterface $message * The text of the message. * @param string|null $wrapper_query_selector * The query selector of the element to display messages in when they Loading @@ -120,7 +122,9 @@ public function __construct($message, $wrapper_query_selector = NULL, array $opt public function render() { return [ 'command' => 'message', 'message' => $this->message, 'message' => $this->message instanceof MarkupInterface ? (string) $this->message : Xss::filterAdmin($this->message), 'messageWrapperQuerySelector' => $this->wrapperQuerySelector, 'messageOptions' => $this->options, 'clearPrevious' => $this->clearPrevious, Loading core/lib/Drupal/Core/Config/StorageComparer.php +2 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Drupal\Component\Datetime\Time; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\MemoryBackend; use Drupal\Core\Cache\NullBackend; use Drupal\Core\Config\Entity\ConfigDependencyManager; Loading Loading @@ -85,7 +86,7 @@ class StorageComparer implements StorageComparerInterface { * * @var \Drupal\Core\Cache\CacheBackendInterface */ protected $targetCacheStorage; protected CacheBackendInterface $targetCacheStorage; /** * Indicates whether the target storage should be wrapped in a cache. Loading core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldConstraint.php +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,16 @@ class UniqueFieldConstraint extends SymfonyConstraint { public $message = 'A @entity_type with @field_name %value already exists.'; /** * This constraint is case-insensitive by default. * * For example "FOO" and "foo" would be considered as equivalent, and * validation of the constraint would fail. * * @var bool */ public $caseSensitive = FALSE; /** * {@inheritdoc} */ Loading core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php +12 −1 Original line number Diff line number Diff line Loading @@ -64,12 +64,23 @@ public function validate($items, Constraint $constraint): void { ->getStorage($entity_type_id) ->getAggregateQuery() ->accessCheck(FALSE) ->condition($field_name, $item_values, 'IN') ->groupBy("$field_name.$property_name"); if (!$is_new) { $entity_id = $entity->id(); $query->condition($id_key, $entity_id, '<>'); } if ($constraint->caseSensitive) { $query->condition($field_name, $item_values, 'IN'); } else { $or_group = $query->orConditionGroup(); foreach ($item_values as $item_value) { $or_group->condition($field_name, \Drupal::database()->escapeLike($item_value), 'LIKE'); } $query->condition($or_group); } $results = $query->execute(); if (!empty($results)) { Loading Loading
composer.lock +2 −2 Original line number Diff line number Diff line Loading @@ -9336,8 +9336,8 @@ }, "prefer-stable": true, "prefer-lowest": false, "platform": [], "platform-dev": [], "platform": {}, "platform-dev": {}, "platform-overrides": { "php": "8.3.0" }, Loading
core/lib/Drupal/Core/Ajax/MessageCommand.php +7 −3 Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Drupal\Core\Ajax; use Drupal\Component\Render\MarkupInterface; use Drupal\Component\Utility\Xss; use Drupal\Core\Asset\AttachedAssets; /** Loading Loading @@ -68,7 +70,7 @@ class MessageCommand implements CommandInterface, CommandWithAttachedAssetsInter /** * The message text. * * @var string * @var string|\Drupal\Component\Render\MarkupInterface */ protected $message; Loading Loading @@ -96,7 +98,7 @@ class MessageCommand implements CommandInterface, CommandWithAttachedAssetsInter /** * Constructs a MessageCommand object. * * @param string $message * @param string|\Drupal\Component\Render\MarkupInterface $message * The text of the message. * @param string|null $wrapper_query_selector * The query selector of the element to display messages in when they Loading @@ -120,7 +122,9 @@ public function __construct($message, $wrapper_query_selector = NULL, array $opt public function render() { return [ 'command' => 'message', 'message' => $this->message, 'message' => $this->message instanceof MarkupInterface ? (string) $this->message : Xss::filterAdmin($this->message), 'messageWrapperQuerySelector' => $this->wrapperQuerySelector, 'messageOptions' => $this->options, 'clearPrevious' => $this->clearPrevious, Loading
core/lib/Drupal/Core/Config/StorageComparer.php +2 −1 Original line number Diff line number Diff line Loading @@ -4,6 +4,7 @@ use Drupal\Component\Datetime\Time; use Drupal\Component\Datetime\TimeInterface; use Drupal\Core\Cache\CacheBackendInterface; use Drupal\Core\Cache\MemoryBackend; use Drupal\Core\Cache\NullBackend; use Drupal\Core\Config\Entity\ConfigDependencyManager; Loading Loading @@ -85,7 +86,7 @@ class StorageComparer implements StorageComparerInterface { * * @var \Drupal\Core\Cache\CacheBackendInterface */ protected $targetCacheStorage; protected CacheBackendInterface $targetCacheStorage; /** * Indicates whether the target storage should be wrapped in a cache. Loading
core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldConstraint.php +10 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,16 @@ class UniqueFieldConstraint extends SymfonyConstraint { public $message = 'A @entity_type with @field_name %value already exists.'; /** * This constraint is case-insensitive by default. * * For example "FOO" and "foo" would be considered as equivalent, and * validation of the constraint would fail. * * @var bool */ public $caseSensitive = FALSE; /** * {@inheritdoc} */ Loading
core/lib/Drupal/Core/Validation/Plugin/Validation/Constraint/UniqueFieldValueValidator.php +12 −1 Original line number Diff line number Diff line Loading @@ -64,12 +64,23 @@ public function validate($items, Constraint $constraint): void { ->getStorage($entity_type_id) ->getAggregateQuery() ->accessCheck(FALSE) ->condition($field_name, $item_values, 'IN') ->groupBy("$field_name.$property_name"); if (!$is_new) { $entity_id = $entity->id(); $query->condition($id_key, $entity_id, '<>'); } if ($constraint->caseSensitive) { $query->condition($field_name, $item_values, 'IN'); } else { $or_group = $query->orConditionGroup(); foreach ($item_values as $item_value) { $or_group->condition($field_name, \Drupal::database()->escapeLike($item_value), 'LIKE'); } $query->condition($or_group); } $results = $query->execute(); if (!empty($results)) { Loading