Skip to content

UrlUtils::resolveRelativeUrl wrong result when mixing URLs and absolute paths #90

Description

@aprat84

This function doesn't return correct result when the $base is an URL, and the $rel is an absolute path.

You can test with this WSDL, which via imports, ends up trying to load XMLDSig schema, defined in this file which is imported by the WSDL:

<import namespace="http://www.w3.org/2000/09/xmldsig#" schemaLocation="http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"/>

Debugging \GoetasWebservices\XML\XSDReader\SchemaReader::loadImport, just before calling UrlUtils::resolveRelativeUrl:

# $namespace 
"http://www.w3.org/2000/09/xmldsig#"
 
# $schemaLocation (from XSD)
"http://www.w3.org/TR/xmldsig-core/xmldsig-core-schema.xsd"

# $schemaLocation (resolved to a known local file and overwritten)
"/var/www/html/vendor/goetas-webservices/xsd-reader/src/Resources/xmldsig-core-schema.xsd"

# $base
"https://prewww2.aeat.es/static_files/common/internet/dep/aplicaciones/es/aeat/tikeV1.0/cont/ws/SistemaFacturacion.wsdl"

So it ends up calling
UrlUtils::resolveRelativeUrl('https://prewww2.aeat.es/static_files/common/internet/dep/aplicaciones/es/aeat/tikeV1.0/cont/ws/SistemaFacturacion.wsdl', '/var/www/html/vendor/goetas-webservices/xsd-reader/src/Resources/xmldsig-core-schema.xsd'), which ends in the file https://prewww2.aeat.es/var/www/html/vendor/goetas-webservices/xsd-reader/src/Resources/xmldsig-core-schema.xsd, which is wrong.

IMHO if $rel is an absolute path, it should just be returned as is. Or treat it differently in \GoetasWebservices\XML\XSDReader\SchemaReader::loadImport.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions