demo icon indicating copy to clipboard operation
demo copied to clipboard

Running "./bin/phpunit" fails on PHP 7.4

Open derickr opened this issue 4 years ago • 7 comments

When running $ ./bin/phpunit as per the README, I am getting the following error with PHP 7.4:

derick@gargleblaster:/tmp/tracer_demo$ ./bin/phpunit 
#!/usr/bin/env php
Installing phpunit/phpunit (7.5.16)
Plugins have been disabled.
  - Installing phpunit/phpunit (7.5.16): Loading from cache
Created project in phpunit-7.5
composer.json has been updated
Loading composer repositories with package information

                                                       
  [ErrorException]                                     
  Trying to access array offset on value of type null  
                                                       

install [--prefer-source] [--prefer-dist] [--dry-run] [--dev] [--no-dev] [--no-custom-installers] [--no-autoloader] [--no-scripts] [--no-progress] [--no-suggest] [-v|vv|vvv|--verbose] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--ignore-platform-reqs] [--] [<packages>]...

derickr avatar Oct 08 '19 10:10 derickr

this seems to be a bug in composer itself, as the error happens during the composer install (of the phpunit codebase).

stof avatar Oct 08 '19 10:10 stof

It may be a problem in one of the scripts Symfony registers in Composer.

Try to add -v (verbose) option to get more details, i.e., stack trace.

jkufner avatar Oct 08 '19 10:10 jkufner

-v doesn't do anything different, as this goes through the bin/phpunit thing, which doesn't accept -v.

derickr avatar Oct 08 '19 11:10 derickr

you might temporarily edit vendor/symfony/phpunit-bridge/bin/simple-phpunit.php to add a -v in the command running composer.

stof avatar Oct 08 '19 14:10 stof

I have tried it now and had no problems. This is my setup:

# OS: macOS 10.15.2

$ composer --version
Composer version 1.9.1 2019-11-01 17:20:17

$ ./bin/console about
 -------------------- -----------------------------------------------------
  Symfony
 -------------------- -----------------------------------------------------
  Version              5.0.1
  Long-Term Support    No
  End of maintenance   07/2020
  End of life          07/2020
 -------------------- -----------------------------------------------------
  Kernel
 -------------------- -----------------------------------------------------
  Type                 App\Kernel
  Environment          dev
  Debug                true
  Charset              UTF-8
  Cache directory      ./var/cache/dev (7.5 MiB)
  Log directory        ./var/log (190 KiB)
 -------------------- -----------------------------------------------------
  PHP
 -------------------- -----------------------------------------------------
  Version              7.4.1
  Architecture         64 bits
  Intl locale          en_US
  Timezone             UTC (2019-12-29T15:44:13+00:00)
  OPcache              true
  APCu                 true
  Xdebug               true
 -------------------- -----------------------------------------------------
  Environment (.env)
 -------------------- -----------------------------------------------------
  APP_ENV              dev
  APP_SECRET           67d829bf61dc5f87a73fd814e2c9f629
  DATABASE_URL         sqlite:///%kernel.project_dir%/data/database.sqlite
  MAILER_URL           null://localhost
 -------------------- -----------------------------------------------------

fox91 avatar Dec 29 '19 15:12 fox91

Also have this problem.

Composer version 1.9.2 Symfony 4.4.2 PHP 7.4.1

But it is working on: Composer version 1.9.1 Symfony 4.4.2 PHP 7.3

wingsergey avatar Jan 15 '20 13:01 wingsergey

composer self-update solved the problem for me since I was using pretty old version.

gabrielius159 avatar Feb 04 '20 10:02 gabrielius159

Let's close this old issue because the newest Symfony Demo versions already require PHP 8.1. Thanks.

javiereguiluz avatar Dec 13 '22 15:12 javiereguiluz