MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001394XdebugCode Coveragepublic2017-01-28 21:162017-01-29 12:34
ReporteriRaS 
Assigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
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)
DescriptionA 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 Reproducecreate 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
Attached Files? file icon test.php [^] (395 bytes) 2017-01-28 21:16

- Relationships

-  Notes
(0004193)
derick (administrator)
2017-01-29 12:12

I'll have a look in a bit.
(0004194)
derick (administrator)
2017-01-29 12:34

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


Copyright © 2000 - 2017 MantisBT Team
Powered by Mantis Bugtracker