Constants

SUFFIX_ALLOW

SUFFIX_ALLOW = '_ALLOW_XDEBUG'

SUFFIX_INIS

SUFFIX_INIS = '_ORIGINAL_INIS'

RESTART_ID

RESTART_ID = 'internal'

RESTART_SETTINGS

RESTART_SETTINGS = 'XDEBUG_HANDLER_SETTINGS'

DEBUG

DEBUG = 'XDEBUG_HANDLER_DEBUG'

ENV_ALLOW

ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG'

ENV_VERSION

ENV_VERSION = 'COMPOSER_XDEBUG_VERSION'

Properties

$tmpIni

$tmpIni : string|null

Type

string|null

$inRestart

$inRestart : 

Type

$name

$name : 

Type

$skipped

$skipped : 

Type

$cli

$cli : 

Type

$colorOption

$colorOption : 

Type

$debug

$debug : 

Type

$envAllowXdebug

$envAllowXdebug : 

Type

$envOriginalInis

$envOriginalInis : 

Type

$loaded

$loaded : 

Type

$persistent

$persistent : 

Type

$script

$script : 

Type

Methods

__construct()

__construct(\Symfony\Component\Console\Output\OutputInterface  $output) 

Constructor

The $envPrefix is used to create distinct environment variables. It is uppercased and prepended to the default base values. For example 'myapp' would result in MYAPP_ALLOW_XDEBUG and MYAPP_ORIGINAL_INIS.

Parameters

\Symfony\Component\Console\Output\OutputInterface $output

setLogger()

setLogger(\Psr\Log\LoggerInterface  $logger) : $this

Activates status message output to a PSR3 logger

Parameters

\Psr\Log\LoggerInterface $logger

Returns

$this

setMainScript()

setMainScript(string  $script) : $this

Sets the main script location if it cannot be called from argv

Parameters

string $script

Returns

$this

setPersistent()

setPersistent() : $this

Persist the settings to keep xdebug out of sub-processes

Returns

$this

check()

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 restarted process is created only once.

getAllIniFiles()

getAllIniFiles() : array

Returns an array of php.ini locations with at least one entry

The equivalent of calling php_ini_loaded_file then php_ini_scanned_files. The loaded ini location is the first entry and may be empty.

Returns

array

getRestartSettings()

getRestartSettings() : array|null

Returns an array of restart settings or null

Settings will be available if the current process was restarted, or called with the settings from an existing restart.

Returns

array|null

getSkippedVersion()

getSkippedVersion() : string

Returns the xdebug version that triggered a successful restart

Returns

string

requiresRestart()

requiresRestart(boolean  $isLoaded) : boolean

Returns true if xdebug is loaded, or as directed by an extending class

Parameters

boolean $isLoaded

Whether xdebug is loaded

Returns

boolean

restart()

restart(string  $command) 

Allows an extending class to access the tmpIni

Parameters

string $command

doRestart()

doRestart(string  $command) 

Executes the restarted command then deletes the tmp ini

Parameters

string $command

prepareRestart()

prepareRestart() : boolean

Returns true if everything was written for the restart

If any of the following fails (however unlikely) we must return false to stop potential recursion:

  • tmp ini file creation
  • environment variable creation

Returns

boolean

writeTmpIni()

writeTmpIni(array  $iniFiles) : boolean

Returns true if the tmp ini file was written

Parameters

array $iniFiles

All ini files used in the current process

Returns

boolean

getCommand()

getCommand() : string

Returns the restart command line

Returns

string

setEnvironment()

setEnvironment(boolean  $scannedInis, array  $iniFiles) : boolean

Returns true if the restart environment variables were set

No need to update $_SERVER since this is set in the restarted process.

Parameters

boolean $scannedInis

Whether there were scanned ini files

array $iniFiles

All ini files used in the current process

Returns

boolean

notify()

notify(string  $op, null|string  $data = null) 

Logs status messages

Parameters

string $op

Status handler constant

null|string $data

Optional data

mergeLoadedConfig()

mergeLoadedConfig(array  $loadedConfig, array  $iniConfig) : string

Returns default, changed and command-line ini settings

Parameters

array $loadedConfig

All current ini settings

array $iniConfig

Settings from user ini files

Returns

string

checkMainScript()

checkMainScript() : boolean

Returns true if the script name can be used

Returns

boolean

setEnvRestartSettings()

setEnvRestartSettings(string  $envArgs) 

Adds restart settings to the environment

Parameters

string $envArgs

syncSettings()

syncSettings(array  $settings) 

Syncs settings and the environment if called with existing settings

Parameters

array $settings

checkScanDirConfig()

checkScanDirConfig() : boolean

Returns true if there are scanned inis and PHP is able to report them

php_ini_scanned_files will fail when PHP_CONFIG_FILE_SCAN_DIR is empty. Fixed in 7.1.13 and 7.2.1

Returns

boolean