[xml] forward-slashes being removed from URL "file:///" prefix



Somewhere between libxml 2.9.0 and 2.9.2, possibly at the commit referenced in a previous discussion[1], forward slashes started to be removed from resolved relative URLs, changing a "file:///" prefix to "file:/".

This makes PHP's DOMDocument (which uses libxml) throw an error when loading an entity, as it's now given a URL with a "file:/" (single forward slash) prefix.

This will succeed:
DOMDocument::load('file:///path/to/some/file.xml');
and this will fail:
DOMDocument::load('file:/path/to/some/file.xml');

In my case, I have a catalog file that references DTD files using a relative path:<rewriteURI uriStartString="http://jats.nlm.nih.gov/" rewritePrefix="jats/"/>

This used to convert
http://jats.nlm.nih.gov/publishing/1.0/JATS-journalpublishing1.dtd
to
file:///opt/schema/jats/publishing/1.0/JATS-journalpublishing1.dtd
but now it gets converted to
file:/opt/schema/jats/publishing/1.0/JATS-journalpublishing1.dtd
and PHP throws an error:
DOMDocument::loadXML(): failed to load external entity "file:/opt/schema/jats/publishing/1.0/JATS-journalpublishing1.dtd" 

A system using PHP built against libxml 2.9.0 doesn't have this problem, but a system using PHP built against libxml 2.9.2 does.

Should I report this as a bug?

Alf

[1] https://mail.gnome.org/archives/xml/2014-September/msg00018.html


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]