Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Prevent setting null debuggee ID #2252

Merged
merged 2 commits into from
Aug 16, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion Debugger/src/Debuggee.php
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,6 @@ public function updateBreakpointBatch(array $breakpoints, array $options = [])
public function info()
{
$info = [
'id' => $this->id,
'project' => $this->project,
'uniquifier' => $this->uniquifier,
'description' => $this->description,
Expand All @@ -384,6 +383,11 @@ public function info()
}, $this->extSourceContexts)
];

// Do not include the ID unless it is set.
if ($this->id) {
$info['id'] = $this->id;
}

if ($this->status instanceof StatusMessage) {
$info['status'] = $this->status->info();
} elseif ($this->status) {
Expand Down
2 changes: 1 addition & 1 deletion Debugger/tests/Unit/DebuggeeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function testProvidesDeprecatedSourceContext()
public function testRegisterSetsDebuggeeId()
{
$this->connection->registerDebuggee(Argument::that(function ($args) {
return $args['debuggee']['id'] == null;
return !isset($args['debuggee']['id']);
}), Argument::any())->willReturn([
'debuggee' => [
'id' => 'debuggee1'
Expand Down