Skip to content

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

Closed

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.

Activity

  1. staabm commented on Dec 19, 2025

    @staabm
    Contributor

    @stijnh92 thanks for the report. please give the fix in #1132 a try

  2. stijnh92 commented on Dec 19, 2025

    @stijnh92
    Author

    @staabm perfect, that works 🙏

  3. changed the title [-]Invalid XML generated when using a combination of PCOV and Xdebug[/-] [+]Invalid XML generated when both PCOV and Xdebug are loaded[/+] on Dec 19, 2025
  4. added a commit that references this issue on Dec 19, 2025
    8adf337
  5. added a commit that references this issue on Dec 19, 2025
    6d84e78
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions