GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: Add DBGP emulator by carlos-granados · Pull Request #37 · php-debugger/php-debugger

Conversation

@carlos-granados

@carlos-granados carlos-granados commented Apr 4, 2026

Copy link
Copy Markdown
Collaborator

Xdebug has the functionality needed to emulate a DBGP client defined in the DebugClient class but this was only used in tests.

In this PR we use this existing functionality to create a DBGP client emulator which can be run as a daemon, listening for incoming connections. It accepts an argument pointing to a file which contains a list of DBGP commands. When it accepts a connection, it will send these commands to the running php debugger and record the conversation.

This tool can be useful for two thing:

  • Debugging the php debugger by emulating a connection with a client
  • Testing the performance of the debugger when connection to a client

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@carlos-granados
carlos-granados requested a review from pronskiy April 4, 2026 08:00
@carlos-granados
carlos-granados force-pushed the feature/add-dbgp-emulator branch from a60159e to 22ced68 Compare April 7, 2026 23:17
pronskiy
pronskiy reviewed Apr 8, 2026
View reviewed changes
Comment thread tests/debugger/dbgp/dbgp-emulator.php Outdated
public function __construct()
{
parent::__construct();
$this->setPort(9003);

@pronskiy pronskiy Apr 8, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as I understand DebugClient already reads $_ENV['XDEBUG_TEST_PORT'] so maybe use that or add -port=9003 ?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@carlos-granados carlos-granados Apr 9, 2026

Copy link
Copy Markdown
Collaborator Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does not actually use that ENV. I have added a --port command line option

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/debugger/dbgp/dbgp-emulator.php Outdated
echo "Waiting for debugger connection...\n";

$daemon->runEmulator();
?>

@pronskiy pronskiy Apr 8, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
?>

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread tests/debugger/dbgp/dbgp-emulator.php
<?php
require_once __DIR__ . '/dbgpclient.php';

class DbgpEmulator extends DebugClient

@pronskiy pronskiy Apr 8, 2026

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some usage example in PHPDoc would be good

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

carlos-granados reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
carlos-granados added 2 commits April 9, 2026 19:15
@carlos-granados
feat: Add DBGP emulator
cb75715
@carlos-granados
Changes after PR review
596444d
@carlos-granados
carlos-granados force-pushed the feature/add-dbgp-emulator branch from 22ced68 to 596444d Compare April 9, 2026 17:15
@pronskiy
pronskiy merged commit 34176e9 into php-debugger:main Apr 11, 2026
11 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@carlos-granados
carlos-granados deleted the feature/add-dbgp-emulator branch April 11, 2026 12:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@pronskiy pronskiy pronskiy left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@carlos-granados @pronskiy
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.