diff options
author | Anatol Belski <ab@php.net> | 2014-04-01 10:13:38 +0200 |
---|---|---|
committer | Anatol Belski <ab@php.net> | 2014-04-01 10:13:38 +0200 |
commit | ef6538875f838bb38f73afedc21ab5cb6697a29e (patch) | |
tree | 91f02643d508e3012616f50ea5cad48d535fd015 | |
parent | e265df460d4829492c1eab69723c0f2dc31c809e (diff) | |
parent | 8e238148f95c23ff2fc160a6bd01b8268a3191c3 (diff) | |
download | php-git-ef6538875f838bb38f73afedc21ab5cb6697a29e.tar.gz |
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
updated NEWS
updated NEWS
added test for bug #53965
Fixed bug #53965 <xsl:include> cannot find files w/ relative paths when loaded w/ "file://"
-rw-r--r-- | ext/dom/document.c | 6 | ||||
-rw-r--r-- | ext/xsl/tests/53965/collection.xml | 13 | ||||
-rw-r--r-- | ext/xsl/tests/53965/collection.xsl | 11 | ||||
-rw-r--r-- | ext/xsl/tests/53965/include.xsl | 7 | ||||
-rw-r--r-- | ext/xsl/tests/bug53965.phpt | 27 |
5 files changed, 64 insertions, 0 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c index 73bc8c1c62..095f96dc09 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 diff --git a/ext/xsl/tests/53965/collection.xml b/ext/xsl/tests/53965/collection.xml new file mode 100644 index 0000000000..a3039cd101 --- /dev/null +++ b/ext/xsl/tests/53965/collection.xml @@ -0,0 +1,13 @@ +<?xml version="1.0"?> +<collection> + <cd> + <title>Fight for your mind</title> + <artist>Ben Harper</artist> + <year>1995</year> + </cd> + <cd> + <title>Electric Ladyland</title> + <artist>Jimi Hendrix</artist> + <year>1997</year> + </cd> +</collection>
\ 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 0000000000..5474f863ec --- /dev/null +++ b/ext/xsl/tests/53965/collection.xsl @@ -0,0 +1,11 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + + <xsl:include href="include.xsl"/> + + <xsl:param name="owner" select="'Nicolas Eliaszewicz'"/> + <xsl:output method="html" encoding="iso-8859-1" indent="no"/> + <xsl:template match="collection"> + Hey! Welcome to <xsl:value-of select="$owner"/>'s sweet CD collection! + <xsl:apply-templates/> + </xsl:template> +</xsl:stylesheet>
\ 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 0000000000..4a01296705 --- /dev/null +++ b/ext/xsl/tests/53965/include.xsl @@ -0,0 +1,7 @@ +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:template match="cd"> + <h1><xsl:value-of select="title"/></h1> + <h2>by <xsl:value-of select="artist"/> - <xsl:value-of select="year"/></h2> + <hr /> + </xsl:template> +</xsl:stylesheet>
\ 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 0000000000..8de777ed63 --- /dev/null +++ b/ext/xsl/tests/bug53965.phpt @@ -0,0 +1,27 @@ +--TEST-- +Bug #53965 (<xsl:include> cannot find files with relative paths when loaded with "file://") +--SKIPIF-- +<?php +if (!extension_loaded('xsl')) die("skip Extension XSL is required\n"); +?> +--FILE-- +<?php + +$base = 'file://' . dirname(__FILE__) . DIRECTORY_SEPARATOR . '53965'; + +$xml = new DOMDocument(); +$xml->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! + + <h1>Fight for your mind</h1><h2>by Ben Harper - 1995</h2><hr> + <h1>Electric Ladyland</h1><h2>by Jimi Hendrix - 1997</h2><hr> |