Commit 6435e2ee authored by alexpott's avatar alexpott

Issue #2464605 by willzyx, Dom.: Regression: no link to admin/reports/status/php

parent 87ade2e6
......@@ -7,7 +7,9 @@
namespace Drupal\system\Tests\System;
use Drupal\Core\Url;
use Drupal\simpletest\WebTestBase;
use Drupal\system\SystemRequirements;
/**
* Tests output on the status overview page.
......@@ -35,6 +37,28 @@ public function testStatusPage() {
// Go to Administration.
$this->drupalGet('admin/reports/status');
$this->assertResponse(200, 'The status page is reachable.');
$phpversion = phpversion();
$this->assertText($phpversion, 'Php version is shown on the page.');
// Checks if the suggestion to update to php 5.5.21 or 5.6.5 for disabling
// multiple statements is present when necessary.
if (\Drupal::database()->driver() === 'mysql' && !SystemRequirements::phpVersionWithPdoDisallowMultipleStatements($phpversion)) {
$this->assertText(t('PHP (multiple statement disabling)'));
}
else {
$this->assertNoText(t('PHP (multiple statement disabling)'));
}
if (function_exists('phpinfo')) {
$this->assertLinkByHref(Url::fromRoute('system.php')->toString());
}
else {
$this->assertNoLinkByHref(Url::fromRoute('system.php')->toString());
}
$this->drupalGet('admin/reports/status/php');
$this->assertResponse(200, 'The phpinfo page is reachable.');
}
}
......@@ -57,18 +57,21 @@ function system_requirements($phase) {
);
// Test PHP version and show link to phpinfo() if it's available
$phpversion = phpversion();
$phpversion = $phpversion_label = phpversion();
if (function_exists('phpinfo')) {
// $phpversion is safe and output of l() is safe, so this value is safe.
if ($phase === 'runtime') {
$phpversion_label = SafeMarkup::set($phpversion . ' (' . \Drupal::l(t('more information'), new Url('system.php')) . ')');
}
$requirements['php'] = array(
'title' => t('PHP'),
// $phpversion is safe and output of l() is safe, so this value is safe.
'value' => SafeMarkup::set(($phase == 'runtime') ? $phpversion . ' (' . \Drupal::l(t('more information'), new Url('system.php')) . ')' : $phpversion),
'value' => $phpversion_label,
);
}
else {
$requirements['php'] = array(
'title' => t('PHP'),
'value' => $phpversion,
'value' => $phpversion_label,
'description' => t('The phpinfo() function has been disabled for security reasons. To see your server\'s phpinfo() information, change your PHP settings or contact your server administrator. For more information, <a href="@phpinfo">Enabling and disabling phpinfo()</a> handbook page.', array('@phpinfo' => 'http://drupal.org/node/243993')),
'severity' => REQUIREMENT_INFO,
);
......@@ -86,7 +89,7 @@ function system_requirements($phase) {
if (($phase === 'install' || \Drupal::database()->driver() === 'mysql') && !SystemRequirements::phpVersionWithPdoDisallowMultipleStatements($phpversion)) {
$requirements['php'] = array(
'title' => t('PHP (multiple statement disabling)'),
'value' => $phpversion,
'value' => $phpversion_label,
'description' => t('PHP versions higher than 5.6.5 or 5.5.21 provide built-in SQL injection protection for mysql databases. It is recommended to update.'),
'severity' => REQUIREMENT_INFO,
);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment