user5542121
user5542121

Reputation: 1052

xdebug-helper is not being applied to the iframe

Using xdebug does not trigger on the embeded iframe - while it does on the page containing the iframe. Same problem happens in Brave browser, while it works in Firefox.

This plugin: https://chrome.google.com/webstore/detail/xdebug-helper/eadndfjplgieldjbigjakmdgkmoaaaoc

Is there a plugin which works, or a setting in Chrome which fixes that?

Upvotes: 1

Views: 492

Answers (2)

user5542121
user5542121

Reputation: 1052

So I found a different solution, which does not require to change php settings. There is 4 ways to trigger xdebug externally, through GET, POST, cookie and in PHP code xdebug_break();. Since the iframe is loaded through GET, its possible to add a param which enables xdebug.
https://example.com/iframe.php?XDEBUG_SESSION_START=XDEBUG_ECLIPSE

More information is here: https://xdebug.org/docs/remote#activate_debugger

Since one might only want to append xdebug param, when xdebug is enabled in the "main" request - it can be checked with following code:

if (extension_loaded('xdebug') && xdebug_is_enabled()) {
    //add param to url
}

Upvotes: 1

Derick
Derick

Reputation: 36774

It's likely a limitation of the Chrome/Brave browser. However, you should be able to work around this, by setting xdebug.remote_autostart=1 in your php.ini file and restart the web server. With that setting, Xdebug will always (try to) initiate a debugging connection to your IDE.

Upvotes: 4

Related Questions