diff --git a/utils/build/docker/php/parametric/server.php b/utils/build/docker/php/parametric/server.php index bf78e46e78..b4a28c401a 100644 --- a/utils/build/docker/php/parametric/server.php +++ b/utils/build/docker/php/parametric/server.php @@ -108,7 +108,8 @@ function remappedSpanKind($spanKind) { $router = new Router($server, $logger, $errorHandler); $router->addRoute('POST', '/trace/span/start', new ClosureRequestHandler(function (Request $req) use (&$spans, &$activeSpan, &$spansDistributedTracingHeaders) { - if ($parent = arg($req, 'parent_id')) { + $parent = arg($req, 'parent_id'); + if ($parent !== null) { if (isset($spans[$parent])) { \DDTrace\switch_stack($spans[$parent]); \DDTrace\create_stack(); @@ -167,7 +168,7 @@ function remappedSpanKind($spanKind) { return $headers[$headername] ?? null; }; \DDTrace\consume_distributed_tracing_headers($callback); - $spanID = $span->parentId ?? null; + $spanID = $span->parentId ?? 0; $spansDistributedTracingHeaders[$spanID] = $headers; return jsonResponse(["span_id" => $spanID]); }));