View Issue Details

IDProjectCategoryView StatusLast Update
0001280XdebugUncategorizedpublic2016-03-08 11:46
ReporterMazeChaZer Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
PlatformPHP 7OSLinux 
Product Version2.4.0rc4 
Fixed in Version2.4.0 
Summary0001280: Wrong coverage report in switch case statements since PHP 7
Description

Example 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 Reproduce

Run the example code with PHP 7 and PHPUnit 5.2.10

Additional Information

Works 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.