[xdebug-general] Code Coverage of "non PHP code"

From: Andres Riancho <andres.riancho[@]gmail.com>
Date: Sat, 20 Mar 2010 20:59:43 -0200

List,

    I'm trying to create a simple xdebug wrapper that will return the
% of code covered by one HTTP request, and I have this simple PHP
script:

"""
<?php
    xdebug_start_code_coverage();
?>
AAA
<?
    echo "B";
    var_dump(xdebug_get_code_coverage());
?>
"""

    That returns this when executed:
      5 => int 1
      6 => int 1
      7 => int 1

    The problem I have is that xdebug is simply ignoring the line with
the A's, even though its being handled by PHP. Because of this error,
my code coverage % never reaches to 100%, even though I'm covering all
the code with that request. Don't get me wrong... I understand that
the PHP code coverage is 100%, but doing something like:

$percentage = $lines_reported_by_xdebug / $total_lines_in_file;

    Never returns 1. In this case it will return 3/8. (there are other
extra issues here like xdebug not counting lines 1, 2 and 3, but I can
solve that by using PHP's prepend_file and append_file).

    Now... the questions are: Is there a way to configure xdebug to
count those extra lines also? If this is not something that most users
would like to have, but one of the developers knows where to change
the code in order to get this feature to work, please do tell me so I
can change it myself.

    Thanks!

Regards,

-- 
Andrés Riancho
Founder, Bonsai - Information Security
http://www.bonsai-sec.com/
http://w3af.sf.net/
Received on Sat Mar 20 2010 - 23:00:03 GMT

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