View Issue Details

IDProjectCategoryView StatusLast Update
0001394XdebugCode Coveragepublic2017-01-29 12:34
ReporteriRaS Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSManjaro LinuxOS Version16.10
Product Version2.4.1 
Target Version2.5.1Fixed in Version2.5.1 
Summary0001394: Code coverage does not cover instanceof (in elseif)
Description

A elseif with expression ($a instanceof Class) is not shown for coverage. Even if the the inner part is getting executed.

It works with other elseif parts very well. Even if I can't set a break point there.

When you reproduce with the script I provided you will see that all lines except this elseif get a hit.

Steps To Reproduce

create a file with this content and execute it:
<?php

xdebug_start_code_coverage();

function whatAmI($var) {
if (is_string($var)) {
return 'string';
} elseif ($var instanceof \stdClass) {
return '\stdClass';
} elseif (is_scalar($var)) {
return 'scalar';
}
return 'dunno!';
}

whatAmI(new \stdClass);
whatAmI(123);
whatAmI('string');
whatAmI(new DateTime());

var_dump(xdebug_get_code_coverage());

TagsNo tags attached.
Operating System
PHP Version7.0.10-7.0.14

Activities

derick

2017-01-29 12:12

administrator   ~0004193

I'll have a look in a bit.

derick

2017-01-29 12:34

administrator   ~0004194

Fixed in GIT for 2.5.1.