MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001559XdebugCode Coveragepublic2018-06-13 16:522018-06-18 20:28
Reporterdtowell 
Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
StatusnewResolutionopen 
PlatformOSCentOSOS Version7
Product Version2.6.0 
Target VersionFixed in Version 
Summary0001559: Missing lines from "top level" code
DescriptionUnexecuted "top level" code lines are not included in coverage report, yet similar unexecuted code lines inside a function is reported are.
Steps To Reproduce<?php
xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
$x = 5*5;
if ($x < 20) {
    echo "low\n";
    $x = 1000;
}
function f($y) {
    if ($y < 20) {
        echo "low 2\n";
        $y = 1000;
    }
}
f($x);
print_r(xdebug_get_code_coverage());

produces:

Array
(
    [/var/www/x.php] => Array
        (
            [3] => 1
            [4] => 1
            [8] => 1
            [9] => 1
            [10] => -1
            [11] => -1
            [13] => 1
            [14] => 1
            [15] => 1
        )

)

Observe 5 & 6 are missing.
TagsNo tags attached.
Operating SystemCentOS 7
PHP Version7.1.15-7.1.19
Attached Files

- Relationships

-  Notes
(0004674)
dtowell (reporter)
2018-06-18 20:28

After poking around xdebug source for a while. I have the following observations that may be helpful, but YMMV.

(1) Changes to xdebug_set_filter() do not effect the results.

(2) A hinting flag may conflict between xdebug and PHP/Zend
PHP/ZEND has:
#define ZEND_ACC_HAS_TYPE_HINTS 0x10000000
xdebug has:
#define ZEND_XDEBUG_VISITED 0x10000000
The PHP comments *imply* that this is for functions only, so it may be a false trail, but it still seems bad.

(3) I think the problem may be in "prefilling" -- prefill_from_oparray(), but cannot easily test without building.

(4) xdebug_func_format() has a default case that seem related (code not in a function or class method), but that might be a false trail too.

- Issue History
Date Modified Username Field Change
2018-06-13 16:52 dtowell New Issue
2018-06-18 20:28 dtowell Note Added: 0004674


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker