View Issue Details

IDProjectCategoryView StatusLast Update
0000472XdebugUncategorizedpublic2009-10-15 17:25
Reporterauroraeosrose Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status closedResolutionfixed 
Product Version2.0.0dev 
Summary0000472: Dead Code Analysis for code coverage messed up after goto
Description

in 5.3 the following code

if ($foo) {
goto blah;
}

The bottom closing brace always shows up as an "uncovered" line of code

TagsNo tags attached.
Operating SystemN/A
PHP Version5.3.0

Activities

derick

2009-10-09 13:28

administrator   ~0001083

I can not reproduce this with Xdebug from CVS/HEAD:

derick@kossu:~/dev/php/xdebug/tests$ cat bug00472test.php
<?php require 'bug00472.phpt';
class CcTest extends PHPUnit_Framework_TestCase
{
public function testOne()
{
GotoTest::testMethod();
}
}
?>

derick@kossu:~/dev/php/xdebug/tests$ cat bug00472.phpt
<?php
class GotoTest
{
static public function testMethod()
{
$foo = true;

    if ($foo) {
        goto blah;
    }
    echo 42, "\n";

    blah:
        echo 42, "\n";
}

}
?>

derick@kossu:~/dev/php/xdebug/tests$ phpunit --coverage-html /tmp/report bug00472test.php

Marks line 10 as grey, and line 11 as red.

auroraeosrose

2009-10-09 14:44

reporter   ~0001084

put another if anotherneath it

class GotoTest
{
static public function testMethod()
{
$foo = true;
$bar = false;

    if ($foo) {
        goto blah;
    }
    if ($bar) {
        goto blah;
    }

    blah:
        echo 42, "\n";
}

}

derick

2009-10-10 10:32

administrator   ~0001088

That creates: http://files.derickrethans.nl/bug472.png which is what I would expect. Do you get something else?

derick

2009-10-15 17:25

administrator   ~0001093

Fixed in CVS (HEAD only)