Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit dd1fd31

Browse filesBrowse files
committed
feature #20971 [WebProfilerBundle] Split PHP version if needed (ro0NL)
This PR was merged into the 3.3-dev branch. Discussion ---------- [WebProfilerBundle] Split PHP version if needed | Q | A | ------------- | --- | Branch? | master | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes/no | Fixed tickets | #20697 (comment) | License | MIT | Doc PR | symfony/symfony-docs#... <!--highly recommended for new features--> Commits ------- 1241a00 [WebProfilerBundle] Split PHP version if needed
2 parents ed5b1d8 + 1241a00 commit dd1fd31
Copy full SHA for dd1fd31

File tree

3 files changed

+19
-3
lines changed
Filter options

3 files changed

+19
-3
lines changed

‎src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig

Copy file name to clipboardExpand all lines: src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<div class="sf-toolbar-info-group">
7676
<div class="sf-toolbar-info-piece sf-toolbar-info-php">
7777
<b>PHP version</b>
78-
<span>
78+
<span{% if collector.phpversionextra %} title="{{ collector.phpversion ~ collector.phpversionextra }}"{% endif %}>
7979
{{ collector.phpversion }}
8080
&nbsp; <a href="{{ path('_profiler_phpinfo') }}">View phpinfo()</a>
8181
</span>
@@ -213,7 +213,7 @@
213213

214214
<div class="metrics">
215215
<div class="metric">
216-
<span class="value">{{ collector.phpversion }}</span>
216+
<span class="value">{{ collector.phpversion }}{% if collector.phpversionextra %} <span class="unit">{{ collector.phpversionextra }}</span>{% endif %}</span>
217217
<span class="label">PHP version</span>
218218
</div>
219219

‎src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/DataCollector/ConfigDataCollector.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ public function collect(Request $request, Response $response, \Exception $except
8989
$this->data['symfony_eom'] = $eom->format('F Y');
9090
$this->data['symfony_eol'] = $eol->format('F Y');
9191
}
92+
93+
if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
94+
$this->data['php_version'] = $matches[1];
95+
$this->data['php_version_extra'] = $matches[2];
96+
}
9297
}
9398

9499
public function getApplicationName()
@@ -174,6 +179,16 @@ public function getPhpVersion()
174179
return $this->data['php_version'];
175180
}
176181

182+
/**
183+
* Gets the PHP version extra part.
184+
*
185+
* @return string|null The extra part
186+
*/
187+
public function getPhpVersionExtra()
188+
{
189+
return isset($this->data['php_version_extra']) ? $this->data['php_version_extra'] : null;
190+
}
191+
177192
/**
178193
* @return int The PHP architecture as number of bits (e.g. 32 or 64)
179194
*/

‎src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/HttpKernel/Tests/DataCollector/ConfigDataCollectorTest.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ public function testCollect()
3030
$this->assertTrue($c->isDebug());
3131
$this->assertSame('config', $c->getName());
3232
$this->assertSame('testkernel', $c->getAppName());
33-
$this->assertSame(PHP_VERSION, $c->getPhpVersion());
33+
$this->assertRegExp('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION);
34+
$this->assertRegExp('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION);
3435
$this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture());
3536
$this->assertSame(class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', $c->getPhpIntlLocale());
3637
$this->assertSame(date_default_timezone_get(), $c->getPhpTimezone());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.