Skip to content

Files that have only \r (CR, 0x0d) EOL characters are not handled correctly #885

Description

@kolesar-andras
Q A
php-code-coverage version 9.2.9
PHP version 7.4.3
Driver Xdebug
Xdebug version (if used) 2.9.2
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 9.5.10

Files that have only \r (CR, 0x0d) characters on line ends and having at least two comment lines cause failure:

Generating code coverage report in HTML format ... $nonCommentLinesOfCode must not be negative

Linux command wc -l shows 0 for these files beacuse it counts LF characters. Number of lines is 1 because no LF characters are in the file. $nonCommentLinesOfCode = 1-2 = -1 triggers the bug.

Macintosh files before OS X had this type of line endings.

Similar to previously fixed issue #831.

Activity

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

Metadata

Metadata

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions