Skip to content

Avoid HTTP request to load XML Schema during validation of XML configuration file #6289

@staabm

Description

@staabm
Q A
PHPUnit version 12.1.0
PHP version 8.4.5
Installation Method phive

per report in infection/infection#2303 it seems phpunit is using a non local path for the schema.xsd which means running phpunit only works with a online connection (when infection triggers schema validation).

We need to use infection from a gitlab CI which have access to the internet behind a proxy. In the CI we set http_proxy and https_proxy env vars (with the proxy url). It's working for tools like composer (composer install downloads dependencies correctly for example). Infection try to validate the phpunit.xml.dist xml file with DOMDocument::schemaValidate and, as the xsi:noNamespaceSchemaLocation attribute value is the external url https://schema.phpunit.de/12.1/phpunit.xsd infection need to access to it through the proxy server.

We can see that in this commit : 0385463 if phpunit is installed with composer, the default value of xsi:noNamespaceSchemaLocation is the local phpunit.xsd file. But in the project, we install phpunit with phive. So the default xsd is https://schema.phpunit.de/12.1/phpunit.xsd.

I have no experience with phive and cannot confirm the claim made though.

in case the initial reported problem really exist, would it be possible to change the path to the schema xsd to a local path?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions