diff --git a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php index 565fa4e6f7..40817d28b5 100644 --- a/core/lib/Drupal/Core/Field/FieldTypePluginManager.php +++ b/core/lib/Drupal/Core/Field/FieldTypePluginManager.php @@ -168,7 +168,7 @@ public function getPreconfiguredOptions($field_type) { */ public function getPluginClass($type) { $plugin_definition = $this->getDefinition($type, FALSE); - return $plugin_definition['class']; + return $plugin_definition['class'] ?? NULL; } } diff --git a/core/lib/Drupal/Core/Field/WidgetBase.php b/core/lib/Drupal/Core/Field/WidgetBase.php index c3b67ba0b7..689b7128bc 100644 --- a/core/lib/Drupal/Core/Field/WidgetBase.php +++ b/core/lib/Drupal/Core/Field/WidgetBase.php @@ -456,8 +456,8 @@ public function flagErrors(FieldItemListInterface $items, ConstraintViolationLis } // Otherwise, pass errors by delta to the corresponding sub-element. else { - $original_delta = $field_state['original_deltas'][$delta]; - $delta_element = $element[$original_delta]; + $original_delta = $field_state['original_deltas'][$delta] ?? NULL; + $delta_element = $element[$original_delta] ?? NULL; } foreach ($delta_violations as $violation) { // @todo: Pass $violation->arrayPropertyPath as property path. diff --git a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php index 48dbb81b47..55d641a823 100644 --- a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php +++ b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php @@ -82,7 +82,7 @@ public function normalize($field_item, $format = NULL, array $context = []) { // Normalize the target entity. $embedded = $this->serializer->normalize($target_entity, $format, $context); - $link = $embedded['_links']['self']; + $link = $embedded['_links']['self'] ?? NULL; // If the field is translatable, add the langcode to the link relation // object. This does not indicate the language of the target entity. if ($langcode) { diff --git a/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php index 373c3f03ad..f07c173336 100644 --- a/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php +++ b/core/modules/link/src/Plugin/Field/FieldType/LinkItem.php @@ -188,7 +188,7 @@ public function setValue($values, $notify = TRUE) { } // Unserialize the values, this is deprecated as the storage takes care of // this, options must not be passed as a string anymore. - if (is_string($values['options'])) { + if (isset($values['options']) && is_string($values['options'])) { @trigger_error('Support for passing options as a serialized string is deprecated in 8.7.0 and will be removed before Drupal 9.0.0. Pass them as an array instead. See https://www.drupal.org/node/2961643.', E_USER_DEPRECATED); $values['options'] = unserialize($values['options'], ['allowed_classes' => FALSE]); } diff --git a/core/modules/search/src/SearchQuery.php b/core/modules/search/src/SearchQuery.php index 9e47cf1a42..6e342ca202 100644 --- a/core/modules/search/src/SearchQuery.php +++ b/core/modules/search/src/SearchQuery.php @@ -246,7 +246,7 @@ protected function parseSearchExpression() { // Strip off phrase quotes. $phrase = FALSE; - if ($match[2]{0} == '"') { + if ($match[2][0] == '"') { $match[2] = substr($match[2], 1, -1); $phrase = TRUE; $this->simple = FALSE; diff --git a/core/tests/Drupal/KernelTests/KernelTestBase.php b/core/tests/Drupal/KernelTests/KernelTestBase.php index dfda4a9fc0..290e494aea 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBase.php +++ b/core/tests/Drupal/KernelTests/KernelTestBase.php @@ -605,7 +605,7 @@ protected function tearDown() { // Remove all prefixed tables. $original_connection_info = Database::getConnectionInfo('simpletest_original_default'); - $original_prefix = $original_connection_info['default']['prefix']['default']; + $original_prefix = $original_connection_info['default']['prefix']['default'] ?? NULL; $test_connection_info = Database::getConnectionInfo('default'); $test_prefix = $test_connection_info['default']['prefix']['default']; if ($original_prefix != $test_prefix) {