php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22868 xslt_process() not reading files relative to script
Submitted: 2003-03-25 02:16 UTC Modified: 2003-04-23 04:51 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: kirk at coraldesigns dot com Assigned:
Status: Not a bug Package: XSLT related
PHP Version: 4.3.2 Stable 22 April OS: Windows XP
Private report: No CVE-ID: None
 [2003-03-25 02:16 UTC] 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.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-22 22:00 UTC] 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-23 04:51 UTC] sniper@php.net
From Manual:

"Note:  Please note that file:// is needed in front of path if you use Windows."
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 23 14:01:31 2024 UTC