From 3cb056f523d470a677a1c7fc186ce2720fece535 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 1 Apr 2014 10:07:18 +0200 Subject: [PATCH 1/4] Fixed bug #53965 cannot find files w/ relative paths when loaded w/ "file://" --- ext/dom/document.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ext/dom/document.c b/ext/dom/document.c index 19acff7468e..f105f6d7fe8 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1509,6 +1509,12 @@ char *_dom_get_valid_file_path(char *source, char *resolved_path, int resolved_p if (uri->scheme != NULL) { /* absolute file uris - libxml only supports localhost or empty host */ +#ifdef PHP_WIN32 + if (strncasecmp(source, "file://",7) == 0 && ':' == source[8]) { + isFileUri = 1; + source += 7; + } else +#endif if (strncasecmp(source, "file:///",8) == 0) { isFileUri = 1; #ifdef PHP_WIN32 From fca1501ed6ab2018cc114899fe8fc1f203befb6b Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 1 Apr 2014 10:08:08 +0200 Subject: [PATCH 2/4] added test for bug #53965 --- ext/xsl/tests/53965/collection.xml | 13 +++++++++++++ ext/xsl/tests/53965/collection.xsl | 11 +++++++++++ ext/xsl/tests/53965/include.xsl | 7 +++++++ ext/xsl/tests/bug53965.phpt | 27 +++++++++++++++++++++++++++ 4 files changed, 58 insertions(+) create mode 100644 ext/xsl/tests/53965/collection.xml create mode 100644 ext/xsl/tests/53965/collection.xsl create mode 100644 ext/xsl/tests/53965/include.xsl create mode 100644 ext/xsl/tests/bug53965.phpt diff --git a/ext/xsl/tests/53965/collection.xml b/ext/xsl/tests/53965/collection.xml new file mode 100644 index 00000000000..a3039cd1015 --- /dev/null +++ b/ext/xsl/tests/53965/collection.xml @@ -0,0 +1,13 @@ + + + + Fight for your mind + Ben Harper + 1995 + + + Electric Ladyland + Jimi Hendrix + 1997 + + \ No newline at end of file diff --git a/ext/xsl/tests/53965/collection.xsl b/ext/xsl/tests/53965/collection.xsl new file mode 100644 index 00000000000..5474f863ec4 --- /dev/null +++ b/ext/xsl/tests/53965/collection.xsl @@ -0,0 +1,11 @@ + + + + + + + + Hey! Welcome to 's sweet CD collection! + + + \ No newline at end of file diff --git a/ext/xsl/tests/53965/include.xsl b/ext/xsl/tests/53965/include.xsl new file mode 100644 index 00000000000..4a01296705c --- /dev/null +++ b/ext/xsl/tests/53965/include.xsl @@ -0,0 +1,7 @@ + + +

+

by -

+
+
+
\ No newline at end of file diff --git a/ext/xsl/tests/bug53965.phpt b/ext/xsl/tests/bug53965.phpt new file mode 100644 index 00000000000..8de777ed630 --- /dev/null +++ b/ext/xsl/tests/bug53965.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #53965 ( cannot find files with relative paths when loaded with "file://") +--SKIPIF-- + +--FILE-- +load($base . DIRECTORY_SEPARATOR . 'collection.xml'); + +$xsl = new DOMDocument(); +$xsl->load($base . DIRECTORY_SEPARATOR . 'collection.xsl'); + +$proc = new XSLTProcessor; +$proc->importStyleSheet($xsl); + +echo $proc->transformToXML($xml); +?> +--EXPECTF-- +Hey! Welcome to Nicolas Eliaszewicz's sweet CD collection! + +

Fight for your mind

by Ben Harper - 1995


+

Electric Ladyland

by Jimi Hendrix - 1997


From f244513fc059a9b7ee2b91ad65f1a2f013b5d588 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 1 Apr 2014 10:11:40 +0200 Subject: [PATCH 3/4] updated NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index 82db047e23f..be9cf23237f 100644 --- a/NEWS +++ b/NEWS @@ -8,6 +8,10 @@ PHP NEWS . Fixed bug #66987i (Memory corruption in fileinfo ext / bigendian). (Remi) +- XSL: + . Fixed bug #53965 ( cannot find files with relative paths + when loaded with "file://"). (Anatol) + ?? ??? 2014, PHP 5.4.27 - Core: From 8e238148f95c23ff2fc160a6bd01b8268a3191c3 Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Tue, 1 Apr 2014 10:12:56 +0200 Subject: [PATCH 4/4] updated NEWS --- NEWS | 3 +++ 1 file changed, 3 insertions(+) diff --git a/NEWS b/NEWS index 57ff613eb6e..a988202e9e8 100644 --- a/NEWS +++ b/NEWS @@ -12,6 +12,9 @@ PHP NEWS . Fixed problem in mysqli_commit()/mysqli_rollback() with second parameter (extra comma) and third parameters (lack of escaping). (Andrey) +- XSL: + . Fixed bug #53965 ( cannot find files with relative paths + when loaded with "file://"). (Anatol) ?? ??? 2014, PHP 5.5.11