sebastianbergmann / phpcov

TextUI frontend for php-code-coverage
BSD 3-Clause "New" or "Revised" License
223 stars 58 forks source link

Issue with latest release __PHP_Incomplete_Class #130

Closed zanderwar closed 1 year ago

zanderwar commented 1 year ago

Trying to understand what I'm missing here, I see a release was made 5 hours ago for v9.0.0 and since then all our code coverage merges are failing

Are you able to please tell me how I can lock to ^8 Found it at https://phar.phpunit.de/phpcov-8.2.1.phar

I've been using phpcov successfully for months until the below is forcing me onto the v9

wget https://phar.phpunit.de/phpcov.phar
php phpcov.phar --version
php phpcov.phar merge --clover coverage.xml ./coverage/
2023-02-13 13:59:50 (105 MB/s) - ‘phpcov.phar’ saved [4250061/4250061]

phpcov 9.0.0 by Sebastian Bergmann.
phpcov 9.0.0 by Sebastian Bergmann.

PHP Fatal error:  Uncaught TypeError: Cannot assign __PHP_Incomplete_Class to property SebastianBergmann\CodeCoverage\CodeCoverage::$data of type SebastianBergmann\CodeCoverage\Data\ProcessedCodeCoverageData in /home/runner/work/modio-restapi/modio-restapi/coverage/coverage-external.cov:3

Managed to get a little more information out of it:

phpcov 9.0.0 by Sebastian Bergmann.

PHP Fatal error:  Uncaught TypeError: Cannot assign __PHP_Incomplete_Class to property SebastianBergmann\CodeCoverage\CodeCoverage::$data of type SebastianBergmann\CodeCoverage\Data\ProcessedCodeCoverageData in /Users/zanderwar/Downloads/coverage-external.cov:3
Stack trace:
#0 /Users/zanderwar/Downloads/coverage-external.cov(3): unserialize('O:43:"Sebastian...')
#1 phar:///Users/zanderwar/Documents/modio/modio-restapi/phpcov.phar/src/cli/MergeCommand.php(55): include('/Users/zanderwa...')
#2 phar:///Users/zanderwar/Documents/modio/modio-restapi/phpcov.phar/src/cli/Application.php(48): SebastianBergmann\PHPCOV\MergeCommand->run(Object(SebastianBergmann\PHPCOV\Arguments))
#3 /Users/zanderwar/Documents/modio/modio-restapi/phpcov.phar(1320): SebastianBergmann\PHPCOV\Application->run(Array)
#4 {main}
  thrown in /Users/zanderwar/Downloads/coverage-external.cov on line 3

failing on coverage-external:

<?php
return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'
O:43:"SebastianBergmann\CodeCoverage\CodeCoverage
❯ php -v
PHP 8.1.14 (cli) (built: Jan 12 2023 04:09:32) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.14, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.14, Copyright (c), by Zend Technologies

Thanks for all your awesome tools.

josefbenjac commented 1 year ago

The same thing's happening to me. I see that the task is closed, but it doesn't say how. Are we doing something wrong or is it a bug that will be fixed? Thanks for your time.

CircuitCipher commented 1 year ago

@josefbenjac I also get this issue. It's not obvious from this thread but it appears that installing an older version fixes the issue. After I ran the following in my project and regenerated the coverage files, it seemed to merge files successfully

phive install https://phar.phpunit.de/phpcov-8.2.1.phar

@sebastianbergmann I definitely think more transparency should be provided with this issue instead of just closing it.

zanderwar commented 1 year ago

I updated my script to point directly to 8.2.1 yeah

#!/bin/bash

wget https://phar.phpunit.de/phpcov-8.2.1.phar
mv phpcov-8.2.1.phar phpcov.phar
php phpcov.phar --version
php phpcov.phar merge --clover coverage.xml ./coverage/