-
Notifications
You must be signed in to change notification settings - Fork 160
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix RootSpanData writer interception on consecutive calls
If there's a cache_slot set, it will bypass the write handler, which very much is not what we want. NULL it to prevent assignment. Signed-off-by: Bob Weinand <bob.weinand@datadoghq.com>
- Loading branch information
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--TEST-- | ||
Ensure caching does not bypass the span data write handler | ||
--FILE-- | ||
<?php | ||
|
||
function assign_parent_id($id) { | ||
\DDTrace\root_span()->parentId = $id; | ||
} | ||
|
||
assign_parent_id("123"); | ||
var_dump(\DDTrace\root_span()->parentId); | ||
assign_parent_id("abc"); | ||
var_dump(\DDTrace\root_span()->parentId); | ||
assign_parent_id(-1); | ||
var_dump(\DDTrace\root_span()->parentId); | ||
|
||
?> | ||
--EXPECT-- | ||
string(3) "123" | ||
string(0) "" | ||
string(20) "18446744073709551615" |