MantisBT

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0001601XdebugCode Coveragepublic2019-01-03 13:492019-01-05 08:52
Reporterexussum 
Assigned To 
PrioritynormalSeverityminorReproducibilityalways
StatusnewResolutionopen 
PlatformLinuxOSUbuntu 18.04OS Version
Product Version2.6.1 
Target VersionFixed in Version 
Summary0001601: Line shown as covered when not been run
DescriptionLine shown as covered when not been run
Steps To Reproduce<?php

function test() {
    foreach([1,2] as $a) {
        if (false) {
            try {
                echo "Try";
            } catch (Exception $e) {
                echo "Catch";
            }
        }
    }
}

xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
test();
var_dump(xdebug_get_code_coverage());
xdebug_stop_code_coverage();



The catch line (line 9) is shown as covered, when its not.
Additional InformationRunning the above script line 9 should show as -1, its showing as 1

I get the following.

/tmp/test.php:17:
array(1) {
  '/tmp/test.php' =>
  array(8) {
    [4] =>
    int(1)
    [5] =>
    int(1)
    [7] =>
    int(-1)
    [8] =>
    int(-1)
    [9] =>
    int(1)
    [13] =>
    int(1)
    [16] =>
    int(1)
    [17] =>
    int(1)
  }
}

xdebug 2.6.1 on php 5.6 works as expected,m it seems 7.0+ has this error
TagsNo tags attached.
Operating System
PHP Version7.2.5-7.2.9
Attached Files? file icon test.php [^] (364 bytes) 2019-01-03 13:49

- Relationships

-  Notes
(0004794)
exussum (reporter)
2019-01-03 13:50

Done some more checking, the if can be removed, its the loop and the catch which causes this
(0004795)
exussum (reporter)
2019-01-05 08:52

Sorry can be closed just found the fix in PHP

- Issue History
Date Modified Username Field Change
2019-01-03 13:49 exussum New Issue
2019-01-03 13:49 exussum File Added: test.php
2019-01-03 13:50 exussum Note Added: 0004794
2019-01-05 08:52 exussum Note Added: 0004795


Copyright © 2000 - 2019 MantisBT Team
Powered by Mantis Bugtracker