2

I'm trying to debug a Composer plugin with Xdebug. I have my environment set up (export XDEBUG_SESSION=1) and the Xdebug loaded in php.d. The script breaks at first line in Composer so everything works so far.

In a composer-plugin class method code I add an xdebug_break(). What I get when that code gets executed is Uncaught Error: Call to undefined function xdebug_break().

Does Composer spawn a crippled shell of sorts without the environment set or runs PHP without extensions? How can I fix this to debug the Composer plugin?

LazyOne
  • 158,824
  • 45
  • 388
  • 391
Dinu
  • 1,374
  • 8
  • 21

1 Answers1

2

Found myself the answer: As per Xdebug documentation,

export COMPOSER_ALLOW_XDEBUG=1

did the trick.

Dinu
  • 1,374
  • 8
  • 21
  • For setting the debugging-related environment variable(s) just for the composer execution, prefix the variable(s) before the actual command, e.g.: `COMPOSER_ALLOW_XDEBUG=1 XDEBUG_SESSION=1 composer update` – Abdull Oct 19 '22 at 16:39