magento2: Use of undefined constant GLOB_BRACE in dependency "allure-framework/allure-phpunit"

Preconditions (*)

Magento Version: 2.3.2

Steps to reproduce (*)

./bin/magento dev:test:run unit

Expected result (*)

No PHP Warnings

Actual result (*)

several:

Warning: Use of undefined constant GLOB_BRACE - assumed 'GLOB_BRACE' (this will throw an Error in a future version of PHP) in /var/www/html/src/vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php:74.

Related Informations

Problem is, GLOB_BRACE is not available in alle Unix Systems. For example the often in Docker context used “Alpine” https://github.com/docker-library/php/issues/719

There is an (not merged) upstream PullRequest available in https://github.com/allure-framework/allure-phpunit/pull/44 But I did not check yet, if this is the proper solution.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 4
  • Comments: 21 (15 by maintainers)

Commits related to this issue

Most upvoted comments

@engcom-Delta did you run it in the official php docker container based on alpine?

To reproduce using Docker:

git clone --depth=1 https://github.com/magento/magento2.git
docker run --rm -it -v "$PWD"/magento2:/var/www/html php:7.4-fpm-alpine sh
# Then inside the container:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
php composer.phar install --ignore-platform-reqs
php -d memory_limit=-1 vendor/bin/phpunit -c dev/tests/unit/phpunit.xml.dist

This shows the error:

Warning: Use of undefined constant GLOB_BRACE - assumed ‘GLOB_BRACE’ (this will throw an Error in a future version of PHP) in /var/www/html/vendor/allure-framework/allure-phpunit/src/Yandex/Allure/Adapter/AllureAdapter.php:74.

To fix, allure-framework/allure-phpunit should be upgraded to at least 1.3.1. This is an eventual dependency of magento/magento2-functional-testing-framework. See https://github.com/magento/magento2/issues/24635#issuecomment-566314746.

It’s worth noting this isn’t the only use of GLOB_BRACE within the codebase/dependency tree, but this is the instance that’s the topic of this issue.

@engcom-Delta please re-open this.

Upstream have released version 1.3.1, which includes this fix: https://github.com/allure-framework/allure-phpunit/pull/44#issuecomment-563175882 It looks like there’s a dependency chain preventing this upgrade however:

  • allure-framework/allure-phpunit 1.3.1 requires phpunit/phpunit >=7.0.0
  • codeception/phpunit-wrapper 6.7.0 requires phpunit/phpunit >=6.5.13 <7.0
  • codeception/codeception 2.4.5 requires codeception/phpunit-wrapper ^6.0.9|^7.0.6
  • allure-framework/allure-codeception 1.3.0 requires codeception/codeception ~2.1
  • magento/magento2-functional-testing-framework 2.5.4 requires allure-framework/allure-codeception ~1.3.0
  • No suitable versions of magento/magento2-functional-testing-framework currently available.

(Reopening as this clearly isn’t solved yet.)