summaryrefslogtreecommitdiff
path: root/ext/libxml
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-03-15 18:39:38 +0100
committerAnatol Belski <ab@php.net>2015-03-15 18:39:38 +0100
commit8f0dbe235597626c07167f8f93838335e5cad2e5 (patch)
tree928ec54ff64f829b0c56306ea664d3df241592a3 /ext/libxml
parentbbc183d88a4b9e481f77a87ee539f2d6256478a7 (diff)
parentaf2b0669110ead1d946237500d1e0a4151f0e450 (diff)
downloadphp-git-8f0dbe235597626c07167f8f93838335e5cad2e5.tar.gz
Merge branch 'PHP-5.6'
* PHP-5.6: 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 a9490f7987..52f5dabe69 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -314,6 +314,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;
}