Skip to content

Conversation

@fabriceb
Copy link

Xdebug has an old bug which makes it return corrupted filenames in the code-coverage data in certain cases. Two identified cases:

  • using "assert"
  • using "runkit_function_redefine"

The returned filename will then be:
"[..]/wrongreturn.php(19) : assert code"
instead of
"[..]/wrongreturn.php"

The bug is documented here: http://bugs.xdebug.org/bug_view_page.php?bug_id=0000331

The suggested solution to by-pass this Xdebug bug until it is solved in Xdebug is to clean the filenames containing the pattern /(\d+) :.+/ which should normally be generic enough to solve all the possible cases.

The function to clean the filenames was put in the driver class to decouple Xdebug problems from the rest of the code coverage code.

Let me know if you have any suggestion on how to improve this.

@benja-M-1
Copy link

My html coverage now works !! Thanks

@hakre
Copy link
Contributor

hakre commented Aug 9, 2012

Please report it upstream. That 2007 Xdebug bugreport might have been just forgotten. First fix upstream, and only if not possible do the work-around.

@sebastianbergmann
Copy link
Owner

I agree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants