usabilla / php-docker-template

Docker images for PHP applications, CLI and FPM with shared socket
https://hub.docker.com/r/usabillabv/php
MIT License
177 stars 15 forks source link

Upgrade Xdebug to v3 #164

Closed agustingomes closed 3 years ago

agustingomes commented 3 years ago

Usabilla PHP Docker Template

Reviewers: @usabilla/oss-docker

Type

Please specify the type of changes being proposed:

Q A
Documentation? yes
Dockerfile change? yes
Build feature? yes
Apply CVE Patch? no
Remove CVE Patch? no

Changelog

Notable changes from Xdebug 2

With the introduction of the Xdebug mode in the v3 release, it is now mandatory to specify either xdebug.mode=coverage setting in .ini file, or XDEBUG_MODE=coverage as environment variable, to use the code coverage analysis features. This impacts tools like mutation tests.

We recommend setting the XDEBUG_MODE when booting up a new container. Here's an example on how it could look like:

docker run -it \
  -e XDEBUG_MODE=coverage \
  -v "<HOST_PATH>:<CONTAINER_PATH>" \
  usabillabv/php:7.4-cli-alpine3.12-dev \
  vendor/bin/infection --test-framework-options='--testsuite=unit' -s --threads=12 --min-msi=100 --min-covered-msi=100

Another notable change, is the Xdebug port change. The default port is now 9003 instead of 9000. Check your IDE settings to confirm the correct port is specified.

For the full upgrade guide, please refer to the official upgrade guide.

agustingomes commented 3 years ago

@rdohms indeed. I'm not sure if we have any policies around this. we can discuss it internally to see if we want any policies around it or in general, to understand how to move forward.

Currently, the biggest impact I've seen is that for some tests like mutation (with infection/infection library) and PHPUnit analysis coverage report generation, they will need to have the new Xdebug mode set prior to their execution, either via xdebug.mode in the .ini config files, or via the environment variable XDEBUG_MODE

agustingomes commented 3 years ago

Marking as BC-Change, due to the possibility users of the images needing to adjust their configurations to continue using the Xdebug's code coverage features.