Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,30 @@ public function phpinfoAction(): Response
return new Response($phpinfo, 200, ['Content-Type' => 'text/html']);
}

/**
* Displays the Xdebug info.
*
* @throws NotFoundHttpException
*/
public function xdebugAction(): Response
{
$this->denyAccessIfProfilerDisabled();

if (!\function_exists('xdebug_info')) {
throw new NotFoundHttpException('Xdebug must be installed in version 3.');
}

if (null !== $this->cspHandler) {
$this->cspHandler->disableCsp();
}

ob_start();
xdebug_info();
$xdebugInfo = ob_get_clean();

return new Response($xdebugInfo, 200, ['Content-Type' => 'text/html']);
}

/**
* Displays the source of a file.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
<default key="_controller">web_profiler.controller.profiler::phpinfoAction</default>
</route>

<route id="_profiler_xdebug" path="/xdebug">
<default key="_controller">web_profiler.controller.profiler::xdebugAction</default>
</route>

<route id="_profiler_search_results" path="/{token}/search/results">
<default key="_controller">web_profiler.controller.profiler::searchResultsAction</default>
</route>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,13 @@

<div class="sf-toolbar-info-piece sf-toolbar-info-php-ext">
<b>PHP Extensions</b>
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasxdebug ? 'green' : 'gray' }}">xdebug {{ collector.hasxdebug ? '✓' : '✗' }}</span>
{% if collector.hasXdebugInfo %}
<a href="{{ path('_profiler_xdebug') }}" title="View xdebug_info()">
{% endif %}
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasXdebug ? 'green' : 'gray' }}">Xdebug {{ collector.hasXdebug ? '✓' : '✗' }}</span>
{% if collector.hasXdebugInfo %}
</a>
{% endif %}
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.hasapcu ? 'green' : 'gray' }}">APCu {{ collector.hasapcu ? '✓' : '✗' }}</span>
<span class="sf-toolbar-status sf-toolbar-status-{{ collector.haszendopcache ? 'green' : 'red' }}">OPcache {{ collector.haszendopcache ? '✓' : '✗' }}</span>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ div.sf-toolbar .sf-toolbar-block a:hover {
.sf-toolbar-block .sf-toolbar-info-piece span {
font-size: 12px;
}
div.sf-toolbar .sf-toolbar-block .sf-toolbar-info-piece.sf-toolbar-info-php-ext a {
text-decoration: none;
}

.sf-toolbar-block .sf-toolbar-info {
background-color: #444;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,21 @@ public function isDebug(): bool|string
}

/**
* Returns true if the XDebug is enabled.
* Returns true if the Xdebug is enabled.
*/
public function hasXDebug(): bool
public function hasXdebug(): bool
{
return $this->data['xdebug_enabled'];
}

/**
* Returns true if the function xdebug_info is available.
*/
public function hasXdebugInfo(): bool
{
return \function_exists('xdebug_info');
}

/**
* Returns true if APCu is enabled.
*/
Expand Down