diff --git a/src/Trace/Propagator/BinaryFormatter.php b/src/Trace/Propagator/BinaryFormatter.php index d805f13f3..451f8f533 100644 --- a/src/Trace/Propagator/BinaryFormatter.php +++ b/src/Trace/Propagator/BinaryFormatter.php @@ -59,7 +59,7 @@ public function deserialize($bin) */ public function serialize(SpanContext $context) { - $spanHex = str_pad($context->spanId(), 16, "0", STR_PAD_LEFT); + $spanHex = str_pad($context->spanId() ?? "", 16, "0", STR_PAD_LEFT); $traceOptions = $context->enabled() ? self::OPTION_ENABLED : 0; return pack("CCH*CH*CC", 0, 0, $context->traceId(), 1, $spanHex, 2, $traceOptions); } diff --git a/src/Trace/SpanContext.php b/src/Trace/SpanContext.php index 3bd9b9b03..b76071819 100644 --- a/src/Trace/SpanContext.php +++ b/src/Trace/SpanContext.php @@ -52,6 +52,8 @@ class SpanContext */ private $enabled; + private ?bool $fromHeader; + /** * Creates a new SpanContext instance *