|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-12-19 11:03 UTC] dashiad at hotmail dot com
Description:
------------
Hello, something strange is happening with the document() XSL function, and long directory (+8 characters) names.
Scenarios:
- Passing a non-existent file path to document() (no long names):
Warning issued ("failed to load external entity")
(Normal behaviour)
- Passing an existent or non-existent file path to document() , using long names:
No warning, and, if the file exists, nothing is fetched.
- Passing an existent file path to document, using MSDOS equivalent to long names:
Everything works as it should.Warning, or success.
This is, i have to change:
"C:/Archivos de programa/Apache Group/Apache/htdocs/test.xml"
to
"C:/Archiv~1/Apache~1/Apache/htdocs/test.xml"
to make it work.
Havent tested if the problem is still there if is the xml filename the one with long name.
Following is the reproduce code:
Reproduce code:
---------------
/* PHP FILE.The path should be changed as needed.There are two lines, one with long and other with short names. */
<?
$xml='<?xml version="1.0"?><b></b>';
$xsl='<?xml version="1.0"?><xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" >'.
'<xsl:template match="/">'.
// '<xsl:copy-of select="document(\'C:/Archivos de programa/Apache Group/Apache/htdocs/test.xml\')" />'.
'<xsl:copy-of select="document(\'c:/Archiv~1/Apache~1/Apache/htdocs/test.xml\')" />'.
'</xsl:template></xsl:stylesheet>';
$xmlDoc=new DOMDocument();
$xmlDoc->loadXML($xml);
$xslDoc=new DOMDocument();
$xslDoc->loadXML($xsl);
$proc = new XSLTProcessor;
$proc->importStyleSheet($xslDoc); // attach the xsl rules
echo $proc->transformToXML($xmlDoc)
?>
/* Sample test.xml (external entity).Could be whatever.*/
<?xml version="1.0"?>
<z>
<q>
</q>
</z>
Expected result:
----------------
For clarity, i've not added xml headers.The expected result (using short names,it works):
<?xml version="1.0"?>
<z>
<q>
</q>
</z>
Actual result:
--------------
When using long names...
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>
(ie:nothing)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 00:00:01 2025 UTC |
Not a PHP issue. Must use URIs for paths Use the following or it tries to build a relative path: document(\'file:///'.rawurlencode("C:/Archivos de programa/Apache Group/Apache/htdocs/test.xml").'\')