[WebProfilerBundle] Split PHP version if needed
This commit is contained in:
parent
d6141930e8
commit
1241a00f6d
@ -75,7 +75,7 @@
|
||||
<div class="sf-toolbar-info-group">
|
||||
<div class="sf-toolbar-info-piece sf-toolbar-info-php">
|
||||
<b>PHP version</b>
|
||||
<span>
|
||||
<span{% if collector.phpversionextra %} title="{{ collector.phpversion ~ collector.phpversionextra }}"{% endif %}>
|
||||
{{ collector.phpversion }}
|
||||
<a href="{{ path('_profiler_phpinfo') }}">View phpinfo()</a>
|
||||
</span>
|
||||
@ -213,7 +213,7 @@
|
||||
|
||||
<div class="metrics">
|
||||
<div class="metric">
|
||||
<span class="value">{{ collector.phpversion }}</span>
|
||||
<span class="value">{{ collector.phpversion }}{% if collector.phpversionextra %} <span class="unit">{{ collector.phpversionextra }}</span>{% endif %}</span>
|
||||
<span class="label">PHP version</span>
|
||||
</div>
|
||||
|
||||
|
@ -89,6 +89,11 @@ class ConfigDataCollector extends DataCollector
|
||||
$this->data['symfony_eom'] = $eom->format('F Y');
|
||||
$this->data['symfony_eol'] = $eol->format('F Y');
|
||||
}
|
||||
|
||||
if (preg_match('~^(\d+(?:\.\d+)*)(.+)?$~', $this->data['php_version'], $matches) && isset($matches[2])) {
|
||||
$this->data['php_version'] = $matches[1];
|
||||
$this->data['php_version_extra'] = $matches[2];
|
||||
}
|
||||
}
|
||||
|
||||
public function getApplicationName()
|
||||
@ -174,6 +179,16 @@ class ConfigDataCollector extends DataCollector
|
||||
return $this->data['php_version'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the PHP version extra part.
|
||||
*
|
||||
* @return string|null The extra part
|
||||
*/
|
||||
public function getPhpVersionExtra()
|
||||
{
|
||||
return isset($this->data['php_version_extra']) ? $this->data['php_version_extra'] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int The PHP architecture as number of bits (e.g. 32 or 64)
|
||||
*/
|
||||
|
@ -30,7 +30,8 @@ class ConfigDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertTrue($c->isDebug());
|
||||
$this->assertSame('config', $c->getName());
|
||||
$this->assertSame('testkernel', $c->getAppName());
|
||||
$this->assertSame(PHP_VERSION, $c->getPhpVersion());
|
||||
$this->assertRegExp('~^'.preg_quote($c->getPhpVersion(), '~').'~', PHP_VERSION);
|
||||
$this->assertRegExp('~'.preg_quote((string) $c->getPhpVersionExtra(), '~').'$~', PHP_VERSION);
|
||||
$this->assertSame(PHP_INT_SIZE * 8, $c->getPhpArchitecture());
|
||||
$this->assertSame(\Locale::getDefault() ?: 'n/a', $c->getPhpIntlLocale());
|
||||
$this->assertSame(date_default_timezone_get(), $c->getPhpTimezone());
|
||||
|
Reference in New Issue
Block a user