diff --git a/core/lib/Drupal/Core/Controller/ArgumentResolver/RawParameterValueResolver.php b/core/lib/Drupal/Core/Controller/ArgumentResolver/RawParameterValueResolver.php index 23fb61125c..35e0854fbf 100644 --- a/core/lib/Drupal/Core/Controller/ArgumentResolver/RawParameterValueResolver.php +++ b/core/lib/Drupal/Core/Controller/ArgumentResolver/RawParameterValueResolver.php @@ -15,7 +15,7 @@ final class RawParameterValueResolver implements ArgumentValueResolverInterface * {@inheritdoc} */ public function supports(Request $request, ArgumentMetadata $argument) { - return !$argument->isVariadic() && $request->attributes->has('_raw_variables') && array_key_exists($argument->getName(), (array) $request->attributes->get('_raw_variables')); + return !$argument->isVariadic() && $request->attributes->has('_raw_variables') && $request->attributes->get('_raw_variables')->has($argument->getName()); } /** diff --git a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php index 48dbb81b47..83e728eac2 100644 --- a/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php +++ b/core/modules/hal/src/Normalizer/EntityReferenceItemNormalizer.php @@ -82,7 +82,10 @@ 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']; + // @todo $embedded can be NULL - this breaks PHP 7.4 testing. Using the null + // coalescence operator fixes + // Drupal\Tests\node\Functional\Hal\NodeHalJsonAnonTest for example. + $link = $embedded['_links']['self'] ?? []; // 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) {