From 8b4a560aac55457ffb26351742e9886591eb863d Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 24 Apr 2018 11:45:52 +0300 Subject: [PATCH 1/2] Fixes composer/xdebug-handler:1.1 breaks Requires (currently) https://github.com/johnstevenson/xdebug-handler/tree/standard-input Merge after composer/xdebug-handler#59 is merged and released. Drop `repositories` and adjust the branch. --- composer.json | 12 ++++++++++-- src/prepend.php | 23 ++++++++++++++++++++++- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index 17bb379..672a210 100644 --- a/composer.json +++ b/composer.json @@ -3,13 +3,21 @@ "description": "Runs a php script with XDebug disabled", "keywords" : ["Xdebug", "xdebug", "performance"], "require": { - "composer/xdebug-handler": "^1.0", + "composer/xdebug-handler": "dev-standard-input", "php": "~5.3 || ~7.0" }, + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:johnstevenson/xdebug-handler", + "no-api":true + } + ], "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": { diff --git a/src/prepend.php b/src/prepend.php index 76e5a57..45e672f 100644 --- a/src/prepend.php +++ b/src/prepend.php @@ -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(); +}); From e15affda1a889e6cf1a4c133ffe88ff381e8481f Mon Sep 17 00:00:00 2001 From: Bruce Weirdan Date: Tue, 24 Apr 2018 12:50:15 +0300 Subject: [PATCH 2/2] dropped `repositories` (it doesn't work with travis) --- composer.json | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/composer.json b/composer.json index 672a210..0b4ff7a 100644 --- a/composer.json +++ b/composer.json @@ -3,16 +3,9 @@ "description": "Runs a php script with XDebug disabled", "keywords" : ["Xdebug", "xdebug", "performance"], "require": { - "composer/xdebug-handler": "dev-standard-input", + "composer/xdebug-handler": "dev-master", "php": "~5.3 || ~7.0" }, - "repositories": [ - { - "type": "vcs", - "url": "git@github.com:johnstevenson/xdebug-handler", - "no-api":true - } - ], "require-dev": { "phpunit/phpunit": "^5.0 || ^6.0 || ^7.0", "ext-xdebug": "*",