Skip to content

Commit

Permalink
Properly disable xdebug in the workers
Browse files Browse the repository at this point in the history
  • Loading branch information
theofidry committed Jun 5, 2019
1 parent efe97a7 commit ee256be
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

OS := $(shell uname)
PHPNOGC=php -d zend.enable_gc=0
CCYELLOW=\033[0;33m
CCEND=\033[0m

.PHONY: help
help:
Expand Down Expand Up @@ -204,26 +206,24 @@ endif
.PHONY: e2e_php_settings_checker
e2e_php_settings_checker: ## Runs the end-to-end tests for the PHP settings handler
e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xdebug-enabled vendor box
# No restart needed
@echo "$(CCYELLOW)No restart needed$(CCEND)"
$(DOCKER) -v "$$PWD":/opt/box box_php72 \
php -dphar.readonly=0 -dmemory_limit=-1 \
$(BOX_COMPILE) \
| grep '\[debug\]' \
| tee fixtures/php-settings-checker/actual-output || true
diff fixtures/php-settings-checker/output-all-clear fixtures/php-settings-checker/actual-output

# Xdebug enabled: restart needed
@echo "$(CCYELLOW)Xdebug enabled: restart needed$(CCEND)"
$(DOCKER) -v "$$PWD":/opt/box box_php72_xdebug \
php -dphar.readonly=0 -dmemory_limit=-1 \
$(BOX_COMPILE) \
| grep '\[debug\]' \
| tee fixtures/php-settings-checker/actual-output || true
$(SED) "s/'-c' '.*' '\.\/box'/'-c' '\/tmp-file' 'bin\/box'/" \
fixtures/php-settings-checker/actual-output
$(SED) "s/[0-9]* ms/100 ms/" fixtures/php-settings-checker/actual-output
diff fixtures/php-settings-checker/output-xdebug-enabled fixtures/php-settings-checker/actual-output

# phar.readonly enabled: restart needed
@echo "$(CCYELLOW)phar.readonly enabled: restart needed$(CCEND)"
$(DOCKER) -v "$$PWD":/opt/box box_php72 \
php -dphar.readonly=1 -dmemory_limit=-1 \
$(BOX_COMPILE) \
Expand All @@ -233,7 +233,7 @@ e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xde
$(SED) "s/[0-9]* ms/100 ms/" fixtures/php-settings-checker/actual-output
diff fixtures/php-settings-checker/output-pharreadonly-enabled fixtures/php-settings-checker/actual-output

# Bump min memory limit if necessary
@echo "$(CCYELLOW)Bump min memory limit if necessary (limit lower than default)$(CCEND)"
$(DOCKER) -v "$$PWD":/opt/box box_php72 \
php -dphar.readonly=0 -dmemory_limit=124M \
$(BOX_COMPILE) \
Expand All @@ -243,7 +243,7 @@ e2e_php_settings_checker: docker-images fixtures/php-settings-checker/output-xde
$(SED) "s/[0-9]* ms/100 ms/" fixtures/php-settings-checker/actual-output
diff fixtures/php-settings-checker/output-min-memory-limit fixtures/php-settings-checker/actual-output

# Bump min memory limit if necessary
@echo "$(CCYELLOW)Bump min memory limit if necessary (limit higher than default)$(CCEND)"
$(DOCKER) -e BOX_MEMORY_LIMIT=64M -v "$$PWD":/opt/box box_php72 \
php -dphar.readonly=0 -dmemory_limit=1024M \
$(BOX_COMPILE) \
Expand Down
2 changes: 1 addition & 1 deletion fixtures/php-settings-checker/output-pharreadonly-enabled
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[debug] phar.readonly is enabled
[debug] The xdebug extension is not loaded
[debug] Process restarting (BOX_ALLOW_XDEBUG=internal||1|*|*)
[debug] Running '/usr/local/bin/php' '-n' '-c' '/tmp-file' 'bin/box' 'compile' '--working-dir=fixtures/php-settings-checker' '-vvv' '--no-ansi'
[debug] Running '/usr/local/bin/php' './box' 'compile' '--working-dir=fixtures/php-settings-checker' '-vvv' '--no-ansi'
[debug] Configured `phar.readonly=0`
[debug] Current memory limit: "-1"
[debug] Checking BOX_ALLOW_XDEBUG
Expand Down
2 changes: 1 addition & 1 deletion fixtures/php-settings-checker/output-xdebug-enabled.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[debug] phar.readonly is disabled
[debug] The xdebug extension is loaded (__XDEBUG_VERSION__)
[debug] Process restarting (BOX_ALLOW_XDEBUG=internal|__XDEBUG_VERSION__|1|*|*)
[debug] Running '/usr/local/bin/php' '-n' '-c' '/tmp-file' 'bin/box' 'compile' '--working-dir=fixtures/php-settings-checker' '-vvv' '--no-ansi'
[debug] Running '/usr/local/bin/php' './box' 'compile' '--working-dir=fixtures/php-settings-checker' '-vvv' '--no-ansi'
[debug] Current memory limit: "-1"
[debug] Checking BOX_ALLOW_XDEBUG
[debug] Restarted (100 ms). The xdebug extension is not loaded
Expand Down
2 changes: 2 additions & 0 deletions src/Console/Php/PhpSettingsHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function __construct(LoggerInterface $logger)
{
parent::__construct('box', '--ansi');

$this->setPersistent();

$this->setLogger($logger);
$this->logger = $logger;

Expand Down

0 comments on commit ee256be

Please sign in to comment.