Skip to content
Snippets Groups Projects

Resolve #3514916 "Data too long"

1 unresolved thread
1 file
+ 21
2
Compare changes
  • Side-by-side
  • Inline
@@ -40,8 +40,27 @@ final class ComponentIncompatibilityReasonRepository {
$this->keyValue->delete($key);
}
private function generateKey(string $source_plugin_id, string $identifier): string {
return \sprintf('%s:%s', $source_plugin_id, $identifier);
/**
* Generates a storage key for component incompatibility reasons.
*
* @param string $source_plugin_id
* The plugin ID from which the key is derived.
* @param string $identifier
* A unique identifier for the component.
*
* @return string
* A key suitable for use in KeyValue storage.
*/
protected function generateKey(string $source_plugin_id, string $identifier): string {
$raw_key = $source_plugin_id . ':' . $identifier;
// Hash if the key exceeds 128 characters.
if (strlen($raw_key) > 128) {
// Optionally prefix with "hash:" to distinguish hashed keys.
return 'hash:' . hash('sha256', $raw_key);
}
return $raw_key;
}
public function getReasons(): array {
Loading