Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly disable xdebug in the workers #425

Merged
merged 1 commit into from
Jun 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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