8000 feature #52950 [WebProfilerBundle] Set `XDEBUG_IGNORE` option for all… · symfony/symfony@31b6a56 · GitHub
[go: up one dir, main page]

Skip to content

Commit 31b6a56

Browse files
committed
feature #52950 [WebProfilerBundle] Set XDEBUG_IGNORE option for all XHR (adrolter)
This PR was squashed before being merged into the 7.1 branch. Discussion ---------- [WebProfilerBundle] Set `XDEBUG_IGNORE` option for all XHR | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | yes | Deprecations? | no | Issues | N/A | License | MIT When using an Xdebug browser extension with Symfony, toolbar requests are also processed by Xdebug because the browser extension has set an `XDEBUG_*` cookie on the page. This leads to superfluous breakpoint triggering when debugging at lower levels of the codebase, as well as a performance hit with no gain for every toolbar request, junk profiler/trace output blobs, etc. The only sane way to prevent this behavior seems to be for the cookie to never be sent, as Xdebug has no mechanism for ignoring requests to certain URIs, and detecting this condition at the webserver and rewriting the request before passing it off to PHP is also non-trivial. This PR detects the `XDEBUG_*` cookie and removes it before conducting XHR, then re-sets it after the fact. Thanks! Commits ------- ae07ed0 [WebProfilerBundle] Set `XDEBUG_IGNORE` option for all XHR
2 parents 3215436 + ae07ed0 commit 31b6a56

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/Symfony/Bundle/WebProfilerBundle/CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
CHANGELOG
22
=========
33

4+
7.1
5+
---
6+
7+
* Set `XDEBUG_IGNORE` query parameter when sending toolbar XHR
8+
49
6.4
510
---
611

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_js.html.twig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
}
5252
5353
var request = function(url, onSuccess, onError, payload, options, tries) {
54+
url = new URL(url);
55+
url.searchParams.set('XDEBUG_IGNORE', '1');
56+
url = url.toString();
5457
var xhr = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHTTP');
5558
options = options || {};
5659
options.retry = options.retry || false;

0 commit comments

Comments
 (0)
0