#22868 [Com]: xslt_process() not reading files relative to script
ID: 22868
Comment by: volhv at skyfia dot ru
Reported By: kirk at coraldesigns dot com
Status: Bogus
Bug Type: XSLT related
Operating System: Windows XP
PHP Version: 4.3.2 Stable 22 April
New Comment:
The structure of my server:
Document root is "X:\www\htdocs"
ServerRoot is "X:\www\apache"
PHPRoot is "X:\www\PHP"
everything is configured to work fine without calling Sablotron
functions.
But when passing xslt_process .xslt-filename with script-related path,
for example "./dir/file.xslt", it thinks that current direrctory is
ServerRoot and tries to get file "X:\www\apache\dir\file.xslt" Of
cource function fails.
Warning: Sablotron error on line 28: cannot open file
'x:/www/apache/doc/pt0.xml' in x:\www\htdocs\meridian\inc\xslt.php on
line 10
It works fine on FreeBSD, but doesn't work on Win2k.
EVEN IF I USE "FILE://" BEFORE URI
Previous Comments:
------------------------------------------------------------------------
[2003-04-23 04:51:32] sniper@php.net
From Manual:
"Note: Please note that file:// is needed in front of path if you use
Windows."
------------------------------------------------------------------------
[2003-04-22 22:00:09] kirk at coraldesigns dot com
I just checked it in the latest stable release, it still doesn't work.
I still had to copy both the XSL and XML files to the directory with
php.exe to get it to work.
It however works flawlessly with 4.3.1 under Linux. So this is a Win32
bug alone.
------------------------------------------------------------------------
[2003-04-21 09:18:32] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
------------------------------------------------------------------------
[2003-04-09 16:48:13] sniper@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2003-03-25 02:16:45] kirk at coraldesigns dot com
The xslt_process() command is expecting a uri relative to the path of
php.exe and not that of the script calling it.
Using an XML file and an XSL with the following script:
// script location: c:/apache/htdocs/pathto/test.php
<?php
$xsltproc = xslt_create();
$html = xslt_process($xsltproc, 'test.xml', 'test.xsl');
// some error checking left out for simplicity
echo $html;
?>
I get the following error:
XSLT processing error: cannot open file 'c:/apache/php/test.xsl'
I read the archives, and saw that this bug was previously reported for
4.3.0 and then closed as fixed in CVS. However 4.3.2 RC1 still
exhibits this behaviour. This was then re-tagged as a documentation
error, however this behaviour is not right, as developers should not
have access to the path with php.exe.
Some possible fixes which were recommended were to override the base
path with xslt_set_base(), however this would make the scripts machine
specific and reduce portability.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22868&edit=1
Thread (6 messages)