From 3f1ba54d7b39865b13595398f3fab26d5c6954e6 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Thu, 6 Aug 2015 15:40:29 +0100 Subject: [PATCH] Issue #2546680 by catch: Use hash('crc32b') not crc32() --- core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php | 2 +- core/lib/Drupal/Core/Entity/EntityViewBuilder.php | 2 +- core/lib/Drupal/Core/TypedData/TypedDataManager.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php index 06c836a76005..4c01e13f7208 100644 --- a/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php +++ b/core/lib/Drupal/Core/Config/Testing/ConfigSchemaChecker.php @@ -73,7 +73,7 @@ public function onConfigSave(ConfigCrudEvent $event) { $name = $saved_config->getName(); $data = $saved_config->get(); - $checksum = crc32(serialize($data)); + $checksum = hash('crc32b', serialize($data)); $exceptions = array( // Following are used to test lack of or partial schema. Where partial // schema is provided, that is explicitly tested in specific tests. diff --git a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php index 957c1e42f86a..2fcdce569fda 100644 --- a/core/lib/Drupal/Core/Entity/EntityViewBuilder.php +++ b/core/lib/Drupal/Core/Entity/EntityViewBuilder.php @@ -465,7 +465,7 @@ protected function getSingleFieldDisplay($entity, $field_name, $display_options) // series of fields individually for cases such as views tables. $entity_type_id = $entity->getEntityTypeId(); $bundle = $entity->bundle(); - $key = $entity_type_id . ':' . $bundle . ':' . $field_name . ':' . crc32(serialize($display_options)); + $key = $entity_type_id . ':' . $bundle . ':' . $field_name . ':' . hash('crc32b', serialize($display_options)); if (!isset($this->singleFieldDisplays[$key])) { $this->singleFieldDisplays[$key] = EntityViewDisplay::create(array( 'targetEntityType' => $entity_type_id, diff --git a/core/lib/Drupal/Core/TypedData/TypedDataManager.php b/core/lib/Drupal/Core/TypedData/TypedDataManager.php index 858d13d1fa76..a609f564c2a3 100644 --- a/core/lib/Drupal/Core/TypedData/TypedDataManager.php +++ b/core/lib/Drupal/Core/TypedData/TypedDataManager.php @@ -277,7 +277,7 @@ public function getPropertyInstance(TypedDataInterface $object, $property_name, if ($settings = $root_definition->getSettings()) { // Hash the settings into a string. crc32 is the fastest way to hash // something for non-cryptographic purposes. - $parts[] = crc32(serialize($settings)); + $parts[] = hash('crc32b', serialize($settings)); } // Property path for the requested data object. When creating a list item, // use 0 in the key as all items look the same. -- GitLab