1
0
Fork 0

Merge pull request #7760 from deguif/1.7

Fix ini_get() for boolean values
pull/7762/head
Jordi Boggiano 2018-10-31 16:13:22 +01:00 committed by GitHub
commit ac524e9bf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 7 deletions

View File

@ -279,7 +279,7 @@ class ClassLoader
*/ */
public function setApcuPrefix($apcuPrefix) 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; $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; $errors['allow_url_fopen'] = true;
} }
@ -505,7 +505,7 @@ EOT
$warnings['openssl_version'] = true; $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; $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; $warnings['xdebug_profile'] = true;
} elseif (extension_loaded('xdebug')) { } elseif (extension_loaded('xdebug')) {
$warnings['xdebug_loaded'] = true; $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 // 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', '>=')) { if (version_compare(phpversion('apc'), '3.0.12', '>=')) {
ini_set('apc.cache_by_default', 0); ini_set('apc.cache_by_default', 0);
} else { } else {

View File

@ -41,7 +41,7 @@ class ErrorHandler
return; 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". $message .= "\n\nWarning: You have xdebug.scream enabled, the warning above may be".
"\na legitimately suppressed error that you were not supposed to see."; "\na legitimately suppressed error that you were not supposed to see.";
} }

View File

@ -364,7 +364,7 @@ class RemoteFilesystem
} }
$result = false; $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.')'; $errorMessage = 'allow_url_fopen must be enabled in php.ini ('.$errorMessage.')';
} }
restore_error_handler(); restore_error_handler();