View Issue Details

IDProjectCategoryView StatusLast Update
0001394XdebugCode Coveragepublic2017-01-29 12:34
ReporteriRaS Assigned Toderick  
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.
Attached Files
test.php (395 bytes)
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.

Issue History

Date Modified Username Field Change
2017-01-28 21:16 iRaS New Issue
2017-01-28 21:16 iRaS File Added: test.php
2017-01-29 12:12 derick Note Added: 0004193
2017-01-29 12:12 derick Assigned To => derick
2017-01-29 12:12 derick Status new => acknowledged
2017-01-29 12:21 derick Severity tweak => minor
2017-01-29 12:21 derick Status acknowledged => assigned
2017-01-29 12:21 derick Target Version => 2.5.1
2017-01-29 12:21 derick Summary Code coverage shows not that elseif is covered => Code coverage does not cover instanceof (in elseif)
2017-01-29 12:34 derick Note Added: 0004194
2017-01-29 12:34 derick Status assigned => closed
2017-01-29 12:34 derick Resolution open => fixed
2017-01-29 12:34 derick Fixed in Version => 2.5.1