Phpunit: Process Isolation does not work when PHPDBG is used

Created on 2 Aug 2019  路  10Comments  路  Source: sebastianbergmann/phpunit

| Q | A
| --------------------| ---------------
| PHPUnit version | 8.3.0, 8.3.1 (8.2.x are not affected)
| PHP version | 7.4.0beta1 (cli) (built: Jul 27 2019 01:44:06) ( ZTS )
| Installation Method | Composer

git bisect between 8.3.0 and 8.2.5 points at 69e61bb1463803d5016ea57cb09a021fd50b4a82

Steps to reproduce:

git clone https://github.com/Ocramius/ProxyManager
cd ProxyManager/
git checkout -b phpdbg-fault 72c2cdf3a0c98b3c6c7253a300979d0f877afcee
composer install --ignore-platform-reqs

docker run -it --rm -v "$PWD":/opt/ProxyManager -w /opt/ProxyManager php:7.4.0beta1-zts-buster \
    phpdbg -qrr vendor/bin/phpunit --verbose \
    tests/ProxyManagerTest/GeneratorStrategy/FileWriterGeneratorStrategyTest.php

Observe:

PHPUnit 8.3.0 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.4.0beta1
Configuration: /opt/ProxyManager/phpunit.xml.dist

EEEE                                                                                                                                         4 / 4 (100%)

Time: 195 ms, Memory: 8.00 MB

There were 4 errors:

1) ProxyManagerTest\GeneratorStrategy\FileWriterGeneratorStrategyTest::testGenerate
PHPUnit\Framework\Exception: [Nothing to execute!]

Caused by
ErrorException: unserialize(): Error at offset 0 of 33 bytes in /opt/ProxyManager/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php:271
Stack trace:
#0 [internal function]: PHPUnit\Util\PHP\AbstractPhpProcess::PHPUnit\Util\PHP\{closure}(8, 'unserialize(): ...', '/opt/ProxyManag...', 271, Array)
#1 /opt/ProxyManager/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php(271): unserialize('\e[1;31m[Nothing...')
#2 /opt/ProxyManager/vendor/phpunit/phpunit/src/Util/PHP/AbstractPhpProcess.php(170): PHPUnit\Util\PHP\AbstractPhpProcess->processChildResult(Object(ProxyManagerTest\GeneratorStrategy\FileWriterGeneratorStrategyTest), Object(PHPUnit\Framework\TestResult), '\e[1;31m[Nothing...', '')
#3 /opt/ProxyManager/vendor/phpunit/phpunit/src/Framework/TestCase.php(676): PHPUnit\Util\PHP\AbstractPhpProcess->runTestJob('<?php declare(s...', Object(ProxyManagerTest\GeneratorStrategy\FileWriterGeneratorStrategyTest), Object(PHPUnit\Framework\TestResult))
#4 /opt/ProxyManager/vendor/phpunit/phpunit/src/Framework/TestSuite.php(568): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#5 /opt/ProxyManager/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(616): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#6 /opt/ProxyManager/vendor/phpunit/phpunit/src/TextUI/Command.php(201): PHPUnit\TextUI\TestRunner->doRun(Object(PHPUnit\Framework\TestSuite), Array, true)
#7 /opt/ProxyManager/vendor/phpunit/phpunit/src/TextUI/Command.php(160): PHPUnit\TextUI\Command->run(Array, true)
#8 /opt/ProxyManager/vendor/phpunit/phpunit/phpunit(61): PHPUnit\TextUI\Command::main()
#9 {main}

Accidentally, [Nothing to execute!] is what phpdbg reports in certain circumstances.

The test case with the error is tagged with @runTestsInSeparateProcesses.

typbug

Most helpful comment

To be clear, I'd love to use pcov/xdebug with 7.4 while peeking into newer PHP releases, but that never works due to those projects not targeting PHP until it's fully released. This is the one big advantage of phpdbg, being a SAPI that is directly evolving with the language itself. This problem will pop up with any future language release (and yep, I know that I'm a super-early adopter - we wouldn't notice a lot of bugs otherwise)

All 10 comments

I will not look into this myself but will, of course, review and possibly merge a pull request that addresses this. Because of PCOV and its significant performance improvements not only over Xdebug but also over PHPDBG I do not care enough about PHPDBG anymore to debug problems such as this one.

No questions about PCOV, but if PHPDBG is not supported anymore in 8.3.0, is it going to make sense to warn about that? Or even make a full stop.

I'm sorry to go back and worth about this issue, but if PHPDBG is not supposed to work with process isolation (triggered by @runTestsInSeparateProcesses like in this case, or otherwise), is it better be blunt about that incompatibility, what do you think?

Does it work with PHP(DBG) 7.3? If it does then this is not a critical issue right now as PHP 7.4 has not been released yet.

Neither I do think this is anywhere critical. Please feel free to prioritize this issue as you see fit.

I'll try to get back to this issue sometime later, and if the problem goes away, I'll close it.

FWIW git bisect between 8.3.0 and 8.2.5 points at 69e61bb1463803d5016ea57cb09a021fd50b4a82

I've did the bisect twice, and it still points there. I'll do it again now. Edit: still point there.

We are seeing same error with phpdbg with PHP 7.2 too

https://travis-ci.org/cakephp/cakephp/jobs/566976783

That said I am happy to encounter this bug, helped me discover pcov :slightly_smiling_face:.

To be clear, I'd love to use pcov/xdebug with 7.4 while peeking into newer PHP releases, but that never works due to those projects not targeting PHP until it's fully released. This is the one big advantage of phpdbg, being a SAPI that is directly evolving with the language itself. This problem will pop up with any future language release (and yep, I know that I'm a super-early adopter - we wouldn't notice a lot of bugs otherwise)

I reverted 69e61bb1463803d5016ea57cb09a021fd50b4a82 in https://github.com/sebastianbergmann/phpunit/commit/dc2365bf329ea09a06de9dce5a70185c728e788a for PHPUnit 8.3.4 (not released yet).

Was this page helpful?
0 / 5 - 0 ratings