Browse Source

Merge branch 'PHP-5.6'

* PHP-5.6:
  update NEWS
  updated NEWS
  updated NEWS
  added test for bug #53965
  Fixed bug #53965 <xsl:include> cannot find files w/ relative paths when loaded w/ "file://"
pull/639/head
Anatol Belski 12 years ago
parent
commit
45c1e28161
  1. 6
      ext/dom/document.c
  2. 13
      ext/xsl/tests/53965/collection.xml
  3. 11
      ext/xsl/tests/53965/collection.xsl
  4. 7
      ext/xsl/tests/53965/include.xsl
  5. 27
      ext/xsl/tests/bug53965.phpt

6
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

13
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>

11
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>

7
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>

27
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>
Loading…
Cancel
Save