View Issue Details

IDProjectCategoryView StatusLast Update
0001922XdebugCode Coveragepublic2022-03-15 17:17
Reporterthierrydraper Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.0.1 
Target Version3.0devFixed in Version3.0.2 
Summary0001922: Code coverage misses array assignment lines
Description

Since upgrading to Xdebug 3.0, the code coverage is no longer including the first line in some multi-line assignments.

Running the attached example I would expected 100% code coverage returned, however with Xdebug 3.0.1 it only returns 18 / 21 (missing lines 28, 34 and 43 when put through PHPUnit's --coverage-html). Rolling back to Xdebug 2.9.8 and re-running the test returns 100% code coverage as expected.

Steps To Reproduce

Run the example unit test through PHPUnit 8.5.0:
phpunit --coverage-text --coverage-filter=/tmp/Xdebug /tmp/Xdebug/ExampleTest.php

Additional Information

$ php -v
PHP 7.4.13 (cli) (built: Nov 24 2020 10:03:34) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
with Zend OPcache v7.4.13, Copyright (c), by Zend Technologies
with Xdebug v3.0.1, Copyright (c) 2002-2020, by Derick Rethans

TagsNo tags attached.
Operating SystemFedora 33 with httpd and php-fpm
PHP Version7.4.10-7.4.19

Activities

derick

2020-12-26 14:45

administrator   ~0005619

I think I see the problem, the ASSIGN_DIM opcode isn't overloaded for just coverage, just like ASSIGN_OBJ from 0001910.

derick

2020-12-30 12:33

administrator   ~0005625

https://github.com/xdebug/xdebug/pull/714

bradkent

2022-03-15 17:17

reporter   ~0006246

Issue seems to be back?
Xdebug 3.1.3 (and Xdebug 3.1.1)

    private static function recordTokenClass()
    {
        self::$currentUse = array(     // this line is not covered
            'class' => self::$groupNamespace ?: '',
            'alias' => '',
        );
        self::$recordPart = 'class';
    }