Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

2.1K
Visualizações
PHPUnit Cannot acquire reference to $GLOBALS

I am getting an error when running PHPUnit tests on GitHub actions.

PHP Fatal error:  Cannot acquire reference to $GLOBALS in /home/runner/work/project-name/project-name/vendor/phpunit/phpunit/src/Util/Configuration.php on line 570

It seems like this error is likely related to PHP8 (https://php.watch/versions/8.1/GLOBALS-restrictions), but the test matrix should only be running PHP 7.2 and 7.4 (tests run fine locally on PHP 7.4).

Error shown here in GitHub Actions. Testing matrix is here.

Any help much appreciated!

--

Edit:

Resolved this by specifically setting the PHP Version in the container as the first step:

# PHPUnit errors with latest PHP 8.X build.
# This specifically sets PHP version to 7.4.
- name: Setup PHP with tools
uses: shivammathur/setup-php@v2
with:
    php-version: '7.4'
    tools: phpunit
over 4 years ago · Santiago Trujillo
2 Respostas
Responde à pergunta

0

You are using PHPUnit 7.5.20 which is not compatible with PHP 8.

over 4 years ago · Santiago Trujillo Relatório

0

Had the same error when running a CI job on PHP 8.1 with Composer installation on --prefer-lowest with phpunit version 8.5.12

Bumping the phpunit/phpunit dependency from >=8.5 to >=8.5.23 did resolve this issue.

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda