Skip to content

Invalid XML generated when both PCOV and Xdebug are loaded #1131

@stijnh92

Description

@stijnh92
Q A
php-code-coverage version 12.5.1
PHP version 8.3.28
Driver PCOV / Xdebug
PCOV version (if used) 1.0.12
Xdebug version (if used) 3.5.0
Installation Method Composer
Usage Method PHPUnit
PHPUnit version (if used) 12.5.4

I have created a script that loads the XML coverage file, generated by phpunit, to publish some statistics of our codebase. Since the latest version of php-code-coverage, I am unable to load the XML file with the following error:

PHP Warning:  simplexml_load_file(): index.xml:5: parser error : Attribute name redefined
PHP Warning:  simplexml_load_file():     <driver name="xdebug" version="3.5.0" name="pcov" version="1.0.12"/>

Looking at the XML file, I can see that the name attribute is used twice on the driver tag which is invalid XML:

<driver name="xdebug" version="3.5.0" name="pcov" version="1.0.12"/>

We use PCOV in our pipelines where the phpunit job is executed using a PHP image that has Xdebug enabled by default. We don't really need Xdebug so we can use another image to work around this issue, but I just wanted to report that when using a combination of Xdebug and PCOV, invalid XML is being generated which can not be loaded by the simplexml_load_file function.

Metadata

Metadata

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions