Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Process.php

function Process::setEnv

Same name in this branch
  1. 11.1.x vendor/php-tuf/composer-stager/src/Internal/Process/Service/Process.php \PhpTuf\ComposerStager\Internal\Process\Service\Process::setEnv()
  2. 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

... See full list

File

vendor/composer/xdebug-handler/src/Process.php, line 94

Class

Process
Process utility functions

Namespace

Composer\XdebugHandler

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal