View Issue Details

IDProjectCategoryView StatusLast Update
0001280XdebugUsage problems (Wrong Results)public2016-03-08 11:46
ReporterMazeChaZerAssigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
PlatformPHP 7OSLinuxOS Version
Product Version2.4.0rc4 
Target VersionFixed in Version2.4.0 
Summary0001280: Wrong coverage report in switch case statements since PHP 7
DescriptionExample code:

<?php

class SUT
{
    public function foo($a)
    {
        switch ($a) {
        case 'a':
        case 'b': // <-- This line is reported not covered but it is
            $b = 2;
            break;
        case 'c':
            $b = 3;
            break;
        default:
            $b = 4;
            break;
        }
        return $b;
    }
}

class Test extends PHPUnit_Framework_TestCase
{
    public function test()
    {
        $sut = new SUT();
        $this->assertEquals(2, $sut->foo('a'));
        $this->assertEquals(2, $sut->foo('b'));
        $this->assertEquals(3, $sut->foo('c'));
        $this->assertEquals(4, $sut->foo('d'));
    }
}
Steps To ReproduceRun the example code with PHP 7 and PHPUnit 5.2.10
Additional InformationWorks fine in PHP 5.6
TagsNo tags attached.
Operating SystemLinux
PHP Version7.0.0-7.0.4

Activities

derick

2016-03-04 15:40

administrator   ~0003545

Can you try Xdebug 2.4.0 which got released yesterday please?

And can you please provide full steps on how to run your use case? Just "run with phpunit" doesn't particularly help me :-)

MazeChaZer

2016-03-07 07:30

reporter   ~0003564

The issue is fixed in 2.4.0, thanks!

derick

2016-03-08 11:46

administrator   ~0003567

Thanks for the report, and checking whether it works with 2.4.0. Closing this out now.

Issue History

Date Modified Username Field Change
2016-03-03 14:47 MazeChaZer New Issue
2016-03-04 15:40 derick Note Added: 0003545
2016-03-04 15:40 derick Assigned To => derick
2016-03-04 15:40 derick Status new => feedback
2016-03-07 07:30 MazeChaZer Note Added: 0003564
2016-03-07 07:30 MazeChaZer Status feedback => assigned
2016-03-08 11:46 derick Note Added: 0003567
2016-03-08 11:46 derick Status assigned => resolved
2016-03-08 11:46 derick Fixed in Version => 2.4.0
2016-03-08 11:46 derick Resolution open => no change required
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)