[xdebug-dev] Bug 0000303: Code coverage problem within array definition

From: <noreply[@]lists.xdebug.org>
Date: Fri, 17 Aug 2007 16:35:42 +0200

The following bug has been RESOLVED.
======================================================================
http://bugs.xdebug.org/bug_view_page.php?bug_id=0000303
======================================================================
Reporter: rudis
Handler: derick
======================================================================
Project: Xdebug
Bug ID: 303
Category: Usage problems
Reproducibility: always
Severity: minor
Priority: normal
Status: resolved
Operating System:
PHP Version: 5.2.0
Xdebug Version: 2.0.0
Resolution: not fixable
======================================================================
Date Submitted: 2007-08-17 02:57 CEST
Last Modified: 2007-08-17 16:35 CEST
======================================================================
Summary: Code coverage problem within array definition
Description:
Hi,

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

======================================================================

----------------------------------------------------------------------
 derick - 2007-08-17 16:35 CEST
----------------------------------------------------------------------
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 ~1 '2',
'1'
   6 6 ADD_ARRAY_ELEMENT ~1 '3',
'2'
   7 7 ASSIGN !0,
~1
   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.

Bug History
Date Modified Username Field Change
======================================================================
2007-08-17 02:57rudis New Bug
2007-08-17 02:57rudis Bug Monitored: rudis
2007-08-17 16:35derick Bugnote Added: 0000716
2007-08-17 16:35derick Assigned To => derick
2007-08-17 16:35derick Resolution open => not fixable
2007-08-17 16:35derick Status new => resolved
======================================================================
Received on Fri Aug 17 2007 - 16:35:46 BST

This archive was generated by hypermail 2.2.0 : Sun Jun 24 2018 - 04:00:03 BST