krakjoe / pcov

PCOV - CodeCoverage compatible driver for PHP
Other
697 stars 29 forks source link

Behaviour change with PHP7.2/PCOV1.0.4 #19

Closed LeSuisse closed 5 years ago

LeSuisse commented 5 years ago

Hi,

I seem to encounter an issue when using PCOV 1.0.4 with PHP 7.2 (CentOS 7 env with packages from Remi repository):

$ /opt/remi/php72/root/usr/bin/php -d pcov.directory=. src/vendor/bin/phpunit --debug --config=tests/phpunit/phpunit.xml --coverage-clover=/tmp/coverage.xml tests/phpunit/common/Include/
PHPUnit 8.2.0 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.2.19 with PCOV 1.0.4
Configuration: /tuleap/tests/phpunit/phpunit.xml

Test 'Tuleap\CookieManagerTest::testCookiePrefixIsSet' started
Test 'Tuleap\CookieManagerTest::testCookiePrefixIsSet' ended
Test 'Tuleap\CookieManagerTest::testItDoesNotSetCookiePrefixIfHTTPSIsNotAvailable' started
Test 'Tuleap\CookieManagerTest::testItDoesNotSetCookiePrefixIfHTTPSIsNotAvailable' ended
Test 'Tuleap\CookieManagerTest::testCookiesRemoval' started
Test 'Tuleap\CookieManagerTest::testCookiesRemoval' ended
Test 'Tuleap\CookieManagerTest::testItDeterminesIfACookieCanUseSecureFlag' started
Test 'Tuleap\CookieManagerTest::testItDeterminesIfACookieCanUseSecureFlag' ended
PHP Fatal error:  Uncaught TypeError: is_file() expects parameter 1 to be a valid path, string given in /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php:72
Stack trace:
#0 /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php(72): is_file('\x00filtertestcase...')
#1 /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php(37): PHPUnit\Util\GlobalState::processIncludedFilesAsString(Array)
#2 /tuleap/src/vendor/phpunit/phpunit/src/Framework/TestCase.php(736): PHPUnit\Util\GlobalState::getIncludedFilesAsString()
#3 /tuleap/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(568): PHPUnit\Framework\TestCase->run(Object(PHPUnit\Framework\TestResult))
#4 /tuleap/src/vendor/phpunit/phpunit/src/Framework/TestSuite.php(568): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#5 /tuleap/src/vendor/phpunit/phpunit/src/TextUI/TestRunner.php(619): PHPUnit\Framework\TestSuite->run(Object(PHPUnit\Framework\TestResult))
#6 /tuleap/src/vendor/phpunit/phpunit/src/TextUI/Command.php(201): PHPUnit\TextUI in /tuleap/src/vendor/phpunit/phpunit/src/Util/GlobalState.php on line 72

The same tests run fine when using PHP 7.2/PCOV1.0.3 or PHP 7.3/PCOV1.0.4.

The issue seems to be caused by the usage of the PHPUnit feature @runInSeparateProcess in the next test the testsuite is supposed to execute (https://github.com/Enalean/tuleap/blob/d03d01a75616907f55c4317370861679850b4741/tests/phpunit/common/Include/LoaderSchedulerTest.php#L52).

I also tried to reproduce the issue on a smaller repository than my usual codebase without luck so I'm guessing the number of files covered also play a role.

I have setup a repository to play the tests on Travis to try to ease the reproduction, I got a different output on the failure (different defaults?) but still, it only fails when using PHP7.2/PCOV1.0.4: https://travis-ci.com/LeSuisse/issue-php72-pcov104/builds/114996334 https://github.com/LeSuisse/issue-php72-pcov104

$ php -d pcov.directory=. src/vendor/bin/phpunit --debug --config=tests/phpunit/phpunit.xml --coverage-clover=coverage.xml tests/phpunit/common/Include/
PHPUnit 8.2.0 by Sebastian Bergmann and contributors.
Runtime:       PHP 7.2.16 with PCOV 1.0.4
Configuration: /home/travis/build/LeSuisse/issue-php72-pcov104/tuleap/tests/phpunit/phpunit.xml
Test 'Tuleap\CookieManagerTest::testCookiePrefixIsSet' started
/home/travis/.travis/functions: line 104: 10129 Segmentation fault      (core dumped) php -d pcov.directory=. src/vendor/bin/phpunit --debug --config=tests/phpunit/phpunit.xml --coverage-clover=coverage.xml tests/phpunit/common/Include/
krakjoe commented 5 years ago

Try tip of develop please ?

LeSuisse commented 5 years ago

I confirm it now works as expected, thanks!

https://travis-ci.com/LeSuisse/issue-php72-pcov104/builds/115033178