diff --git a/src/Message/AbstractEnvelope.php b/src/Message/AbstractEnvelope.php index f8482e1c..66b44e54 100644 --- a/src/Message/AbstractEnvelope.php +++ b/src/Message/AbstractEnvelope.php @@ -24,7 +24,7 @@ public function __construct(MessageInterface $message) } $this->message = $message; - if (is_array($this->metadata[EnvelopeInterface::ENVELOPE_STACK_KEY])) { + if (isset($this->metadata[EnvelopeInterface::ENVELOPE_STACK_KEY]) && is_array($this->metadata[EnvelopeInterface::ENVELOPE_STACK_KEY])) { $this->metadata[EnvelopeInterface::ENVELOPE_STACK_KEY] = array_merge( $envelopes, array_filter( diff --git a/src/Middleware/FailureHandling/FailureEnvelope.php b/src/Middleware/FailureHandling/FailureEnvelope.php index 4ccaf0f4..97e194d6 100644 --- a/src/Middleware/FailureHandling/FailureEnvelope.php +++ b/src/Middleware/FailureHandling/FailureEnvelope.php @@ -26,6 +26,6 @@ public static function fromMessage(MessageInterface $message): self protected function getEnvelopeMetadata(): array { - return [self::FAILURE_META_KEY => ArrayHelper::merge($this->metadata[self::FAILURE_META_KEY], $this->failureMeta)]; + return [self::FAILURE_META_KEY => ArrayHelper::merge($this->metadata[self::FAILURE_META_KEY] ?? [], $this->failureMeta)]; } }