summaryrefslogtreecommitdiff
path: root/ext/xmlwriter/php_xmlwriter.c
diff options
context:
space:
mode:
authorPierre Joye <pajoye@php.net>2009-05-25 16:09:27 +0000
committerPierre Joye <pajoye@php.net>2009-05-25 16:09:27 +0000
commitc32cdc4fd0155bf9aa3c7bf689f95ed7167b68e8 (patch)
treefba72f7e0c86e8b811bd8149f4c6113166388a56 /ext/xmlwriter/php_xmlwriter.c
parentc11979a8bf9a20844d7b47994c228cbafc9c016c (diff)
downloadphp-git-c32cdc4fd0155bf9aa3c7bf689f95ed7167b68e8.tar.gz
- better fix for file:/// and file://localhost (thx Ilia), init file_dest when the path is an uri
Diffstat (limited to 'ext/xmlwriter/php_xmlwriter.c')
-rw-r--r--ext/xmlwriter/php_xmlwriter.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/ext/xmlwriter/php_xmlwriter.c b/ext/xmlwriter/php_xmlwriter.c
index c91b4d9254..8e566654bd 100644
--- a/ext/xmlwriter/php_xmlwriter.c
+++ b/ext/xmlwriter/php_xmlwriter.c
@@ -615,7 +615,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
if (uri->scheme != NULL) {
/* absolute file uris - libxml only supports localhost or empty host */
if (strncasecmp(source, "file:///", 8) == 0) {
- if (strlen(source) == 8) {
+ if (source[sizeof("file:///") - 1] == '\0') {
return NULL;
}
isFileUri = 1;
@@ -625,7 +625,7 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
source += 7;
#endif
} else if (strncasecmp(source, "file://localhost/",17) == 0) {
- if (strlen(source) == 17) {
+ if (source[sizeof("file://localhost/") - 1] == '\0') {
return NULL;
}
@@ -659,6 +659,8 @@ static char *_xmlwriter_get_valid_file_path(char *source, char *resolved_path, i
}
file_dest = resolved_path;
+ } else {
+ file_dest = source;
}
xmlFreeURI(uri);