By-Pass Xdebug bug #331 by cleaning the filenames returned in the Xdebug.php driver #89
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Xdebug has an old bug which makes it return corrupted filenames in the code-coverage data in certain cases. Two identified cases:
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.