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: compatibility stubs for stripped Xdebug functions by pronskiy · Pull Request #48 · php-debugger/php-debugger

Conversation

@pronskiy

@pronskiy pronskiy commented Apr 14, 2026 •
edited
Loading

Uh oh!

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

Copy link
Copy Markdown
Member

Adds 34 stub functions for all Xdebug features that were stripped in Phase 1 (profiler, coverage, tracing, gcstats, develop). Each stub emits E_DEPRECATED with a clear message and returns a safe default value.

Fixes #45

Why

Code that calls removed Xdebug functions (e.g. xdebug_get_profiler_filename(), xdebug_start_code_coverage()) currently gets a fatal "undefined function" error. These stubs provide a graceful migration path — the functions exist, warn that they are unavailable, and return harmless defaults.

Changes

  • New: src/lib/compat_stubs.c, src/lib/compat_stubs.h — 37 stub implementations
  • Modified: config.m4, config.w32 — add new source file to build
  • Modified: php_xdebug.stub.php, php_xdebug_arginfo.h — register stubs
  • Modified: xdebug.c — include compat stubs header

Each stub emits E_DEPRECATED and returns a safe default (false, [], 0, etc.).

Example

$ php -dzend_extension=php_debugger.so -r "var_dump(xdebug_get_profiler_filename());"
Deprecated: xdebug_get_profiler_filename() is not available in php-debugger...
bool(false)

Covered modules

  • Profiler: xdebug_get_profiler_filename
  • Coverage: xdebug_start_code_coverage, xdebug_stop_code_coverage, xdebug_get_code_coverage, etc.
  • Tracing: xdebug_start_trace, xdebug_stop_trace, xdebug_get_tracefile_name, etc.
  • GC Stats: xdebug_get_gcstats_filename, xdebug_start_gcstats, xdebug_stop_gcstats, etc.
  • Develop: xdebug_var_dump, xdebug_debug_zval, xdebug_call_class, xdebug_get_headers, etc.

Sorry, something went wrong.

Uh oh!

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

FeBe95 reacted with hooray emoji
All reactions
  • 🎉 1 reaction
@pronskiy
Add compatibility stubs for stripped Xdebug functions
c1a5c2f
Adds fallback implementations for all Xdebug functions that were
removed when non-debugger modules were stripped. Each stub emits
E_DEPRECATED and returns a safe default value.

Fixes #45
@pronskiy
pronskiy marked this pull request as draft April 14, 2026 15:39
pronskiy added 2 commits April 14, 2026 20:26
@pronskiy
refactor: reduce compat stub duplication, fix test failures
a7c13cb
- Remove Xdebug license headers from new files (compat_stubs.c/h)
- Use macros (COMPAT_STUB_RETURN_FALSE, COMPAT_STUB_VOID, etc.) to
  eliminate boilerplate — 262 lines down from 448
- Remove xdebug_get_headers from stub.php: it's the sentinel function
  used by is_stripped_debugger() in the test harness. Registering it
  caused all tests with skip conditions to stop skipping, producing
  false failures on CI.
- Regenerate php_xdebug_arginfo.h
@pronskiy
add tests for compatibility stubs and update stub handling
70a68f1
- Add `compat_stubs.phpt` test to verify stubs emit `E_DEPRECATED` and return safe defaults.
- Adjust `xdebug_debug_zval` and `xdebug_debug_zval_stdout` parameters.
- Update `xdebug_print_function_stack`: use default message, suppress unused parameter warnings.
- Remove redundant `php_var_dump` call in `xdebug_var_dump` stub.
- Regenerate `php_xdebug_arginfo.h` after stub updates.
@pronskiy
pronskiy requested a review from carlos-granados April 14, 2026 21:15
@pronskiy
pronskiy marked this pull request as ready for review April 14, 2026 21:15
@pronskiy pronskiy added the compatibility label Apr 14, 2026
carlos-granados
carlos-granados approved these changes Apr 15, 2026
View reviewed changes

@carlos-granados carlos-granados left a comment

Copy link
Copy Markdown
Collaborator

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.

Thanks @pronskiy, great stuff

Sorry, something went wrong.

Uh oh!

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

All reactions
@pronskiy
pronskiy merged commit 82a0f3d into main Apr 19, 2026
16 of 18 checks passed

Uh oh!

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

pronskiy added a commit that referenced this pull request May 3, 2026
@pronskiy
feat: add php_debugger_info() alias for xdebug_info()
44324ae
Registers php_debugger_info as a ZEND_FALIAS of xdebug_info so the
php_debugger_* function namespace has at least one user-visible entry
point alongside the php_debugger.* INI namespace.

Updates the static-build smoke test to assert php_debugger_info()
exists, replacing a stale assertion for php_debugger_break() (an alias
that was removed when arginfo got regenerated in #48).
pronskiy added a commit that referenced this pull request May 3, 2026
@pronskiy
feat: static build support (--enable-php-debugger) (#47)
1a27e5b
* feat: static build support (--enable-php-debugger)

Add support for compiling php_debugger as a static extension into php-src
using ./configure --enable-php-debugger (without --enable-shared).

Changes:
- MINIT self-registration: in static builds, the Zend extension is registered
  from PHP_MINIT_FUNCTION since zend_startup_extensions() has already run by
  the time MINIT fires. Manually calls xdebug_library_zend_startup() and
  xdebug_debugger_zend_startup() to replicate xdebug_zend_startup() logic.
- xdebug_zend_startup() early return: prevents double module registration
  when zend_startup_extensions() calls it after MINIT already initialized.
- php_php_debugger.h: bridge header providing phpext_php_debugger_ptr for
  PHP's static extension table (main/internal_functions.c).
- config.m4: add PHP_ADD_INCLUDE($ext_srcdir) for header discovery.
- Fix COMPILE_DL_XDEBUG -> COMPILE_DL_PHP_DEBUGGER in RINIT ZTS guard.

Benchmark (PHP 8.6.0-dev, bench.php):
  Vanilla PHP:           0.573s (baseline)
  Static php_debugger:   0.605s (~5.6% overhead, observer API floor)

* ci: add static build smoke test workflow

Dedicated CI job that builds PHP from source with --enable-php-debugger
and verifies the extension loads correctly as a static build.

Only triggers on changes to config.m4, php_php_debugger.h, xdebug.c,
or the workflow itself — does not slow down the main test suite.

Smoke tests:
- Module list (php_debugger + xdebug compat)
- Zend extension registration
- extension_loaded() for both names
- INI settings (both prefixes)
- Function existence (both aliases)

* fix(ci): copy m4 macros to php-src root for buildconf

config.m4 includes m4/pkg.m4 and m4/clocks.m4 which resolve relative
to the php-src root, not the extension directory.

* fix(ci): ensure php-src clone before m4 copy

Remove cache step (not worth complexity for a rarely-triggered workflow).
Always clone fresh — simpler and more reliable.

* fix(ci): ensure m4 directory exists before copying macros

* feat: add php_debugger_info() alias for xdebug_info()

Registers php_debugger_info as a ZEND_FALIAS of xdebug_info so the
php_debugger_* function namespace has at least one user-visible entry
point alongside the php_debugger.* INI namespace.

Updates the static-build smoke test to assert php_debugger_info()
exists, replacing a stale assertion for php_debugger_break() (an alias
that was removed when arginfo got regenerated in #48).
@carlos-granados
carlos-granados deleted the fix/compat-stubs branch May 5, 2026 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@carlos-granados carlos-granados carlos-granados approved these changes

Uh oh!

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

Assignees

No one assigned

Labels

compatibility

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Add fallbacks for unsupported xdebug functions

Uh oh!

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

2 participants

@pronskiy @carlos-granados
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.