Config::ini_set(): fix detecting errors
This commit is contained in:
parent
e8cb6a0343
commit
8f90854f0f
1 changed files with 6 additions and 4 deletions
|
@ -246,11 +246,13 @@ Class Config {
|
||||||
*/
|
*/
|
||||||
public static function ini_set($option, $value) {
|
public static function ini_set($option, $value) {
|
||||||
Log :: trace('Set PHP INI option "%s" to "%s"', $option, $value);
|
Log :: trace('Set PHP INI option "%s" to "%s"', $option, $value);
|
||||||
if (ini_set($option, $value) === false)
|
// ini_set() return the old value in case of success or false in case of error. If option is
|
||||||
|
// unset, ini_set() will also return false. To detect error, compare set value with value
|
||||||
|
// retrieve after using ini_get().
|
||||||
|
ini_set($option, $value);
|
||||||
|
$new_value = ini_get($option);
|
||||||
|
if ($new_value !== $value)
|
||||||
Log::warning('Fail to set PHP INI option "%s" to "%s"', $option, $value);
|
Log::warning('Fail to set PHP INI option "%s" to "%s"', $option, $value);
|
||||||
Log :: trace(
|
|
||||||
'PHP INI option "%s" after setting it to "%s": "%s"',
|
|
||||||
$option, $value, vardump(ini_get($option)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue