summaryrefslogtreecommitdiff
path: root/ext/libxml
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-03-15 18:38:50 +0100
committerAnatol Belski <ab@php.net>2015-03-15 18:38:50 +0100
commitaf2b0669110ead1d946237500d1e0a4151f0e450 (patch)
tree82c66686dad5783e2d23b7f75fdf99f2dc3c143f /ext/libxml
parent2ac31872ac56cbeb3b8ef905c52b8f4dbf682311 (diff)
downloadphp-git-af2b0669110ead1d946237500d1e0a4151f0e450.tar.gz
libxml-2.9.2 compatibility
Diffstat (limited to 'ext/libxml')
-rw-r--r--ext/libxml/libxml.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 13028256eb..49e44dbada 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -306,6 +306,21 @@ static void *php_libxml_streams_IO_open_wrapper(const char *filename, const char
(xmlStrncmp(BAD_CAST uri->scheme, BAD_CAST "file", 4) == 0))) {
resolved_path = xmlURIUnescapeString(filename, 0, NULL);
isescaped = 1;
+#if LIBXML_VERSION >= 20902 && defined(PHP_WIN32)
+ /* Libxml 2.9.2 prefixes local paths with file:/ instead of file://,
+ thus the php stream wrapper will fail on a valid case. For this
+ reason the prefix is rather better cut off. */
+ {
+ size_t pre_len = sizeof("file:/") - 1;
+
+ if (strncasecmp(resolved_path, "file:/", pre_len) == 0
+ && '/' != resolved_path[pre_len]) {
+ xmlChar *tmp = xmlStrdup(resolved_path + pre_len);
+ xmlFree(resolved_path);
+ resolved_path = tmp;
+ }
+ }
+#endif
} else {
resolved_path = (char *)filename;
}