Skip to content

Commit

Permalink
Merge branch 'post-1.1-fixes'
Browse files Browse the repository at this point in the history
  • Loading branch information
weirdan committed Jun 26, 2018
2 parents eafe76b + e15affd commit 006dabb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 3 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
"description": "Runs a php script with XDebug disabled",
"keywords" : ["Xdebug", "xdebug", "performance"],
"require": {
"composer/xdebug-handler": "1.0.0 || >= 1.2",
"composer/xdebug-handler": "^1.1.0",
"php": "~5.3 || ~7.0"
},
"require-dev": {
"phpunit/phpunit": "^5.0 || ^6.0 || ^7.0",
"ext-xdebug": "*",
"php": "~5.6 || ~7.0"
"php": "~5.6 || ~7.0",
"monolog/monolog": "^1.23"
},
"autoload-dev": {
"psr-4": {
Expand Down
23 changes: 22 additions & 1 deletion src/prepend.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,25 @@
// global or project
require __DIR__ . '/../../../autoload.php';
}
(new \Composer\XdebugHandler\XdebugHandler('RUNWITHOUTXDEBUG'))->check();

call_user_func(function() {
$x = new \Composer\XdebugHandler\XdebugHandler('RWX');
if ($logFile = getenv('RWX_DEBUG_LOG')) {
$logger = new \Monolog\Logger('rwx', [new \Monolog\Handler\StreamHandler($logFile)]);
} else {
$logger = new \Psr\Log\NullLogger;
}

// we don't have to detect command line code as auto_prepend_file doesn't work in that case
$mainScript = in_array($_SERVER['argv'][0], ['-', 'Standard input code'], true)
? '--'
: $_SERVER['argv'][0];

$logger->debug('argv[0]: ' . $_SERVER['argv'][0]);
$logger->debug('Main script: ' . $mainScript);

$x->setMainScript($mainScript);

$x->setLogger($logger);
$x->check();
});

0 comments on commit 006dabb

Please sign in to comment.