[xdebug-general] Re: use of XDEBUG_CC_UNUSED

From: Michiel Rook <michiel[@]trendserver.nl>
Date: Thu, 2 Dec 2004 14:26:28 +0100

Hi Derick,

> The result is totally correct. The starting stub *is* executed (the line
> with function a()), but it is executed when the script first runs
> (before you call xdebug_start_code_coverage). The ending stub is not
> executed before you return from the function before reaching the end
> (with the return NULL statement).

Okay, I see what you mean, and I can understand why this is the case. I'm
not
sure I agree from a code-coverage point of view, but I think this has more
to
do with the Zend engine model than with your code. I'm not blaming you ;)

I have, however, another XDEBUG_CC_UNUSED related nag for you :)
The following code:

<?
    xdebug_start_code_coverage(XDEBUG_CC_UNUSED);
    class b
    {
        function a()
        {
            return NULL;
        }
    };
    $cc = xdebug_get_code_coverage();
    xdebug_stop_code_coverage();
    var_dump($cc);
?>

Produces:

array(1) {
  ["/var/www/experiment/xdebug_cc.php"]=>
  array(2) {
    [4]=>
    int(1)
    [10]=>
    int(1)
  }
}

Is this simply a case of missing opcode overrides? (By the way, the class
starting on
line 4 instead of 3 is probably a PHP bug, as I've seen this in their
Reflection API as well,
it does work when "b" is a subclass of another class)

Warm regards,

Michiel Rook
Received on Thu Dec 02 2004 - 14:26:30 GMT

This archive was generated by hypermail 2.2.0 : Mon Jun 25 2018 - 06:00:04 BST