Merge branch '2.8' into 3.4

* 2.8:
  Fixed typo
  Fix ini_get() for boolean values
This commit is contained in:
Nicolas Grekas 2018-10-31 10:06:03 +01:00
commit 63c74f7c29
6 changed files with 9 additions and 9 deletions

View File

@ -681,7 +681,7 @@ UPGRADE FROM 2.x to 3.0
As a value for the option you must provide the fully-qualified class name (FQCN) As a value for the option you must provide the fully-qualified class name (FQCN)
now as well. now as well.
* The `FormIntegrationTestCase` and `FormPerformanceTestCase` classes were moved form the `Symfony\Component\Form\Tests` namespace to the `Symfony\Component\Form\Test` namespace. * The `FormIntegrationTestCase` and `FormPerformanceTestCase` classes were moved from the `Symfony\Component\Form\Tests` namespace to the `Symfony\Component\Form\Test` namespace.
* The constants `ROUND_HALFEVEN`, `ROUND_HALFUP` and `ROUND_HALFDOWN` in class * The constants `ROUND_HALFEVEN`, `ROUND_HALFUP` and `ROUND_HALFDOWN` in class
`NumberToLocalizedStringTransformer` were renamed to `ROUND_HALF_EVEN`, `NumberToLocalizedStringTransformer` were renamed to `ROUND_HALF_EVEN`,

View File

@ -22,7 +22,7 @@ class ApcClassLoaderTest extends TestCase
{ {
protected function setUp() protected function setUp()
{ {
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) { if (!(filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN))) {
$this->markTestSkipped('The apc extension is not enabled.'); $this->markTestSkipped('The apc extension is not enabled.');
} else { } else {
apcu_clear_cache(); apcu_clear_cache();
@ -31,7 +31,7 @@ class ApcClassLoaderTest extends TestCase
protected function tearDown() protected function tearDown()
{ {
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) { if (filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
apcu_clear_cache(); apcu_clear_cache();
} }
} }

View File

@ -137,7 +137,7 @@ class ResourceCheckerConfigCache implements ConfigCacheInterface
} }
} }
if (\function_exists('opcache_invalidate') && ini_get('opcache.enable')) { if (\function_exists('opcache_invalidate') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)) {
@opcache_invalidate($this->file, true); @opcache_invalidate($this->file, true);
} }
} }

View File

@ -45,7 +45,7 @@ class Debug
if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) { if (!\in_array(\PHP_SAPI, array('cli', 'phpdbg'), true)) {
ini_set('display_errors', 0); ini_set('display_errors', 0);
ExceptionHandler::register(); ExceptionHandler::register();
} elseif ($displayErrors && (!ini_get('log_errors') || ini_get('error_log'))) { } elseif ($displayErrors && (!filter_var(ini_get('log_errors'), FILTER_VALIDATE_BOOLEAN) || ini_get('error_log'))) {
// CLI - display errors only if they're not already logged to STDERR // CLI - display errors only if they're not already logged to STDERR
ini_set('display_errors', 1); ini_set('display_errors', 1);
} }

View File

@ -68,8 +68,8 @@ class ConfigDataCollector extends DataCollector implements LateDataCollectorInte
'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a', 'php_intl_locale' => class_exists('Locale', false) && \Locale::getDefault() ? \Locale::getDefault() : 'n/a',
'php_timezone' => date_default_timezone_get(), 'php_timezone' => date_default_timezone_get(),
'xdebug_enabled' => \extension_loaded('xdebug'), 'xdebug_enabled' => \extension_loaded('xdebug'),
'apcu_enabled' => \extension_loaded('apcu') && ini_get('apc.enabled'), 'apcu_enabled' => \extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN),
'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && ini_get('opcache.enable'), 'zend_opcache_enabled' => \extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN),
'bundles' => array(), 'bundles' => array(),
'sapi_name' => \PHP_SAPI, 'sapi_name' => \PHP_SAPI,
); );

View File

@ -39,8 +39,8 @@ class ConfigDataCollectorTest extends TestCase
$this->assertSame(Kernel::VERSION, $c->getSymfonyVersion()); $this->assertSame(Kernel::VERSION, $c->getSymfonyVersion());
$this->assertNull($c->getToken()); $this->assertNull($c->getToken());
$this->assertSame(\extension_loaded('xdebug'), $c->hasXDebug()); $this->assertSame(\extension_loaded('xdebug'), $c->hasXDebug());
$this->assertSame(\extension_loaded('Zend OPcache') && ini_get('opcache.enable'), $c->hasZendOpcache()); $this->assertSame(\extension_loaded('Zend OPcache') && filter_var(ini_get('opcache.enable'), FILTER_VALIDATE_BOOLEAN)), $c->hasZendOpcache());
$this->assertSame(\extension_loaded('apcu') && ini_get('apc.enabled'), $c->hasApcu()); $this->assertSame(\extension_loaded('apcu') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN)), $c->hasApcu());
} }
} }