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

Breadcrumb

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

function XdebugHandler::check

Checks if Xdebug is loaded and the process needs to be restarted

This behaviour can be disabled by setting the MYAPP_ALLOW_XDEBUG environment variable to 1. This variable is used internally so that the restarted process is created only once.

File

vendor/composer/xdebug-handler/src/XdebugHandler.php, line 138

Class

XdebugHandler
@author John Stevenson <john-stevenson@blueyonder.co.uk>

Namespace

Composer\XdebugHandler

Code

public function check() : void {
    $this->notify(Status::CHECK, self::$xdebugVersion . '|' . self::$xdebugMode);
    $envArgs = explode('|', (string) getenv($this->envAllowXdebug));
    if (!(bool) $envArgs[0] && $this->requiresRestart(self::$xdebugActive)) {
        // Restart required
        $this->notify(Status::RESTART);
        $command = $this->prepareRestart();
        if ($command !== null) {
            $this->restart($command);
        }
        return;
    }
    if (self::RESTART_ID === $envArgs[0] && count($envArgs) === 5) {
        // Restarted, so unset environment variable and use saved values
        $this->notify(Status::RESTARTED);
        Process::setEnv($this->envAllowXdebug);
        self::$inRestart = true;
        if (self::$xdebugVersion === null) {
            // Skipped version is only set if Xdebug is not loaded
            self::$skipped = $envArgs[1];
        }
        $this->tryEnableSignals();
        // Put restart settings in the environment
        $this->setEnvRestartSettings($envArgs);
        return;
    }
    $this->notify(Status::NORESTART);
    $settings = self::getRestartSettings();
    if ($settings !== null) {
        // Called with existing settings, so sync our settings
        $this->syncSettings($settings);
    }
}

API Navigation

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