Skip to content

[WebProfilerBundle] Display environment variables #22406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
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 @@ -254,6 +254,25 @@
<a href="{{ path('_profiler_phpinfo') }}">View full PHP configuration</a>
</p>

<h2>Environment Configuration <small>({{ collector.environment|length }})</small></h2>

<table>
<thead>
<tr>
<th class="key">Name</th>
<th>Value</th>
</tr>
</thead>
<tbody>
{% for name in collector.environment|keys|sort %}
<tr>
<th scope="row" class="font-normal">{{ name }}</th>
<td class="font-normal">{{ collector.environment[name] }}</td>
</tr>
{% endfor %}
</tbody>
</table>

{% if collector.bundles %}
<h2>Enabled Bundles <small>({{ collector.bundles|length }})</small></h2>
<table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function collect(Request $request, Response $response, \Exception $except
'zend_opcache_enabled' => extension_loaded('Zend OPcache') && ini_get('opcache.enable'),
'bundles' => array(),
'sapi_name' => PHP_SAPI,
'environment' => $_ENV,
);

if (isset($this->kernel)) {
Expand Down Expand Up @@ -304,6 +305,16 @@ public function getName()
return 'config';
}

/**
* Gets the environment variables.
*
* @return string The environment variables
*/
public function getEnvironment()
{
return $this->data['environment'];
}

/**
* Tries to retrieve information about the current Symfony version.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public function testCollect()
$this->assertSame(extension_loaded('xdebug'), $c->hasXDebug());
$this->assertSame(extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache());
$this->assertSame(extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu());
$this->assertSame($_ENV, $c->getEnvironment());
}
}

Expand Down