diff --git a/Debugger/src/Debuggee.php b/Debugger/src/Debuggee.php index db7c764470a8..a23f52d85820 100644 --- a/Debugger/src/Debuggee.php +++ b/Debugger/src/Debuggee.php @@ -380,7 +380,7 @@ public function info() return is_array($esc) ? $esc['context'] : $esc->context()->info(); }, $this->extSourceContexts), 'extSourceContexts' => array_map(function ($esc) { - return $esc->info(); + return is_array($esc) ? $esc : $esc->info(); }, $this->extSourceContexts) ]; if ($this->status) { diff --git a/Debugger/tests/Unit/DebuggeeTest.php b/Debugger/tests/Unit/DebuggeeTest.php index e2277b034ea2..d23ad1e270ec 100644 --- a/Debugger/tests/Unit/DebuggeeTest.php +++ b/Debugger/tests/Unit/DebuggeeTest.php @@ -150,4 +150,21 @@ public function testRegisterSetsDebuggeeId() $this->assertTrue($debuggee->register()); $this->assertEquals('debuggee1', $debuggee->id()); } + + public function testDebuggeeExtendedSourceContextSerialization() + { + $debuggee = new Debuggee($this->connection->reveal(), [ + 'project' => 'project1', + 'extSourceContexts' => [ + [ + 'context' => [] + ] + ] + ]); + $info = $debuggee->info(); + $this->assertArrayHasKey('extSourceContexts', $info); + $this->assertCount(1, $info['extSourceContexts']); + $this->assertArrayHasKey('sourceContexts', $info); + $this->assertCount(1, $info['sourceContexts']); + } }