1
0
Fork 0

Fix ini_get() for boolean values

pull/7760/head
François-Xavier de Guillebon 2018-10-31 09:55:53 +01:00
parent 11752864eb
commit 114217c6e3
No known key found for this signature in database
GPG Key ID: 4C7866C1D8FE86CE
5 changed files with 7 additions and 7 deletions

View File

@ -279,7 +279,7 @@ class ClassLoader
*/
public function setApcuPrefix($apcuPrefix)
{
$this->apcuPrefix = function_exists('apcu_fetch') && ini_get('apc.enabled') ? $apcuPrefix : null;
$this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null;
}
/**

View File

@ -481,7 +481,7 @@ EOT
$errors['iconv_mbstring'] = true;
}
if (!ini_get('allow_url_fopen')) {
if (!filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
$errors['allow_url_fopen'] = true;
}
@ -505,7 +505,7 @@ EOT
$warnings['openssl_version'] = true;
}
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && ini_get('apc.enable_cli')) {
if (!defined('HHVM_VERSION') && !extension_loaded('apcu') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN)) {
$warnings['apc_cli'] = true;
}
@ -528,7 +528,7 @@ EOT
}
}
if (ini_get('xdebug.profiler_enabled')) {
if (filter_var(ini_get('xdebug.profiler_enabled'), FILTER_VALIDATE_BOOLEAN)) {
$warnings['xdebug_profile'] = true;
} elseif (extension_loaded('xdebug')) {
$warnings['xdebug_loaded'] = true;

View File

@ -255,7 +255,7 @@ class Compiler
*/
// Avoid APC causing random fatal errors per https://github.com/composer/composer/issues/264
if (extension_loaded('apc') && ini_get('apc.enable_cli') && ini_get('apc.cache_by_default')) {
if (extension_loaded('apc') && filter_var(ini_get('apc.enable_cli'), FILTER_VALIDATE_BOOLEAN) && filter_var(ini_get('apc.cache_by_default'), FILTER_VALIDATE_BOOLEAN)) {
if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
ini_set('apc.cache_by_default', 0);
} else {

View File

@ -41,7 +41,7 @@ class ErrorHandler
return;
}
if (ini_get('xdebug.scream')) {
if (filter_var(ini_get('xdebug.scream'), FILTER_VALIDATE_BOOLEAN)) {
$message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
"\na legitimately suppressed error that you were not supposed to see.";
}

View File

@ -364,7 +364,7 @@ class RemoteFilesystem
}
$result = false;
}
if ($errorMessage && !ini_get('allow_url_fopen')) {
if ($errorMessage && !filter_var(ini_get('allow_url_fopen'), FILTER_VALIDATE_BOOLEAN)) {
$errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
}
restore_error_handler();