com php-src: backport af2b0669 into 5.5: ext/libxml/libxml.c
| From: | Anatol Belski | Date: | Mon, 16 Mar 2015 07:32:39 +0000 |
| Subject: | com php-src: backport af2b0669 into 5.5: ext/libxml/libxml.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-85522@lists.php.net to get a copy of this message | ||
Commit: 293d6e629db9db8fd18cb9d15fb38b929cba707b
Author: Anatol Belski <ab@php.net> Mon, 16 Mar 2015 08:32:39 +0100
Parents: c21c8f369d5640e5563e6b2423304ec4f533adfc
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=293d6e629db9db8fd18cb9d15fb38b929cba707b
Log:
backport af2b0669 into 5.5
Changed paths:
M ext/libxml/libxml.c
Diff:
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 5f0da89..c1d31a5 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -305,6 +305,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;
}