function Process::setEnv
Same name in this branch
- 11.1.x vendor/php-tuf/composer-stager/src/Internal/Process/Service/Process.php \PhpTuf\ComposerStager\Internal\Process\Service\Process::setEnv()
- 11.1.x vendor/symfony/process/Process.php \Symfony\Component\Process\Process::setEnv()
Makes putenv environment changes available in $_SERVER and $_ENV
Parameters
string $name:
?string $value A null value unsets the variable:
6 calls to Process::setEnv()
- PhpConfig::updateEnv in vendor/
composer/ xdebug-handler/ src/ PhpConfig.php - Updates a restart settings value in the environment
- Status::reportRestart in vendor/
composer/ xdebug-handler/ src/ Status.php - Restart status message
- Status::__construct in vendor/
composer/ xdebug-handler/ src/ Status.php - XdebugHandler::check in vendor/
composer/ xdebug-handler/ src/ XdebugHandler.php - Checks if Xdebug is loaded and the process needs to be restarted
- XdebugHandler::setEnvRestartSettings in vendor/
composer/ xdebug-handler/ src/ XdebugHandler.php - Adds restart settings to the environment
File
-
vendor/
composer/ xdebug-handler/ src/ Process.php, line 94
Class
- Process
- Process utility functions
Namespace
Composer\XdebugHandlerCode
public static function setEnv(string $name, ?string $value = null) : bool {
$unset = null === $value;
if (!putenv($unset ? $name : $name . '=' . $value)) {
return false;
}
if ($unset) {
unset($_SERVER[$name]);
}
else {
$_SERVER[$name] = $value;
}
// Update $_ENV if it is being used
if (false !== stripos((string) ini_get('variables_order'), 'E')) {
if ($unset) {
unset($_ENV[$name]);
}
else {
$_ENV[$name] = $value;
}
}
return true;
}