Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitdd1fd31

Browse 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 parentsed5b1d8 +1241a00 commitdd1fd31

File tree

3 files changed

+19
-3
lines changed

3 files changed

+19
-3
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
<divclass="sf-toolbar-info-group">
7676
<divclass="sf-toolbar-info-piece sf-toolbar-info-php">
7777
<b>PHP version</b>
78-
<span>
78+
<span{%ifcollector.phpversionextra %}title="{{collector.phpversion~collector.phpversionextra }}"{%endif %}>
7979
{{collector.phpversion }}
8080
&nbsp; <ahref="{{ path('_profiler_phpinfo') }}">View phpinfo()</a>
8181
</span>
@@ -213,7 +213,7 @@
213213

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

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

Lines 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
publicfunctiongetApplicationName()
@@ -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+
publicfunctiongetPhpVersionExtra()
188+
{
189+
returnisset($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‎

Lines 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)

[8]ページ先頭

©2009-2025 Movatter.jp