View Issue Details

IDProjectCategoryView StatusLast Update
0000490XdebugUncategorizedpublic2009-11-23 12:11
ReporterrdohmsAssigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionunable to reproduce 
PlatformMACOSOSXOS Version10.6
Product Version2.0.0dev 
Target VersionFixed in Version 
Summary0000490: Code Coverage Skips line with -= Operator
DescriptionWhen executing a code that uses a -= operator that line is not tagged as executed, even though it is.
Steps To Reproduce<?php

xdebug_start_code_coverage();

class CodeCoverageBug
{

    private $health = 100;
    
    public function hurt($damage)
    {
        $this->health -= $damage;
    }

}


$c = new CodeCoverageBug();
$c->hurt(10);
$c->hurt(10);

var_dump(xdebug_get_code_coverage());
?>
Additional Informationoutput:
array(1) {
  ["/Users/rdohms/dev/sys/bugreprods/ccbug.php"]=>
  array(5) {
    [13]=>
    int(1)
    [18]=>
    int(1)
    [19]=>
    int(1)
    [20]=>
    int(1)
    [22]=>
    int(1)
  }
}

Expected output
array(1) {
  ["/Users/rdohms/dev/sys/bugreprods/ccbug.php"]=>
  array(5) {
    [12]=>
    int(1)
    [18]=>
    int(1)
    [19]=>
    int(1)
    [20]=>
    int(1)
    [22]=>
    int(1)
  }
}

Line 12 which is the line with the operator is not tagged as executed, even further when using XDEBUG_CC_UNUSED it returns as -1
TagsNo tags attached.
Operating SystemMac OSX 10.6
PHP Version5.3.0

Activities

derick

2009-11-22 20:12

administrator   ~0001169

I really need the script as well to go with this bug.

rdohms

2009-11-23 03:18

reporter   ~0001172

Mantis is not giving me the option to attach a file, so the code is here: http://pastebin.com/f608c0ec2

derick

2009-11-23 12:11

administrator   ~0001173

I get the correct result — try latest CVS please?

array(1) {
  ["/tmp/f608c0ec2.php"]=>
  array(7) {
    [6]=>
    int(1)
    [12]=>
    int(1)
    [13]=>
    int(1)
    [18]=>
    int(1)
    [19]=>
    int(1)
    [20]=>
    int(1)
    [22]=>
    int(1)
  }
}

Issue History

Date Modified Username Field Change
2009-11-20 14:05 rdohms New Issue
2009-11-20 14:05 rdohms Operating System => Mac OSX 10.6
2009-11-20 14:05 rdohms PHP Version => 5.3.0
2009-11-20 14:05 rdohms Xdebug Version => 2.0.5
2009-11-22 20:12 derick Note Added: 0001169
2009-11-22 20:12 derick Status new => feedback
2009-11-23 03:18 rdohms Note Added: 0001172
2009-11-23 12:11 derick Note Added: 0001173
2009-11-23 12:11 derick Status feedback => resolved
2009-11-23 12:11 derick Resolution open => unable to reproduce
2009-11-23 12:11 derick Assigned To => derick
2016-07-31 12:36 derick Category Usage problems => Usage problems (Crashes)
2016-07-31 12:38 derick Category Usage problems (Crashes) => Usage problems (Wrong Results)
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized