View Issue Details

IDProjectCategoryView StatusLast Update
0000303XdebugUsage problems (Wrong Results)public2007-08-17 15:35
ReporterrudisAssigned Toderick 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionnot fixable 
Product Version 
Target VersionFixed in Version 
Summary0000303: Code coverage problem within array definition
DescriptionHi,

I know there have been some reports with code coverage problems but I don't know if this is also a problem of the Zend engine and you can't do anything about it or a bug in Xdebug.

If I use the following code only the second line is marked as executed:

$array = array(
  '1' => '2',
  '2' => '3'
  );

And the same is for any longer example like this:

$array = array(
  '1' => '2',
  '2' => '3',
  '3' => '4',
  '4' => '5'
  );

Thanks for your help,
Simon
TagsNo tags attached.
Operating System
PHP Version5.2.0

Activities

derick

2007-08-17 15:35

administrator   ~0000716

I can, the following script:

<?php
xdebug_start_code_coverage(); // 2

$array = array( // 4
  '1' => '2', // 5
  '2' => '3', // 6
); // 7

var_dump( xdebug_get_code_coverage() ); // 9
?>

shows:

array(1) {
  ["/home/httpd/html/test/xdebug/bug303.php"]=>
  array(4) {
    [5]=>
    int(1)
    [6]=>
    int(1)
    [7]=>
    int(1)
    [9]=>
    int(1)
  }
}

As you can see, line 4 is missing. With VLD I checked what PHP generates, and that is:

line # op fetch ext return operands
-------------------------------------------------------------------------------
   2 0 EXT_STMT
         1 EXT_FCALL_BEGIN
         2 DO_FCALL 0 'xdebug_start_code_coverage'
         3 EXT_FCALL_END
   5 4 EXT_STMT
         5 INIT_ARRAY 0000002:0000001 '2', '1'
   6 6 ADD_ARRAY_ELEMENT 0000002:0000001 '3', '2'
   7 7 ASSIGN !0, 0000002:0000001
   9 8 EXT_STMT
         9 EXT_FCALL_BEGIN
        10 EXT_FCALL_BEGIN
        11 DO_FCALL 0 'xdebug_get_code_coverage'
        12 EXT_FCALL_END
        13 SEND_VAR_NO_REF $3
        14 DO_FCALL 1 'var_dump'
        15 EXT_FCALL_END
  11 16 EXT_STMT
        17 RETURN 1
        18* ZEND_HANDLE_EXCEPTION

As you can see, there is no code at all on line 4 for PHP. That means I can't fix it.

Issue History

Date Modified Username Field Change
2007-08-17 01:57 rudis New Issue
2007-08-17 15:35 derick Status new => resolved
2007-08-17 15:35 derick Resolution open => not fixable
2007-08-17 15:35 derick Assigned To => derick
2007-08-17 15:35 derick Note Added: 0000716
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)