php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #49051 XMLWriter::openURI() cannot resolve file path containing slash
Submitted: 2009-07-24 16:22 UTC Modified: 2016-09-18 04:22 UTC
Votes:16
Avg. Score:4.4 ± 0.9
Reproduced:14 of 14 (100.0%)
Same Version:10 (71.4%)
Same OS:4 (28.6%)
From: major at minet dot sk Assigned: cmb (profile)
Status: No Feedback Package: XML Writer
PHP Version: 5.3.0 OS: Vista 32bit
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: major at minet dot sk
New email:
PHP Version: OS:

 

 [2009-07-24 16:22 UTC] major at minet dot sk
Description:
------------
When I try to write content of xml file using XMLWriter, it works fine _only_ if xml file is in the same directory as php script. When path contains slash or backslash, it is unable to open file.
My code works on 5.2.9 but fails when running on 5.3.0 (I use WampServer).

Reproduce code:
---------------
<?php
$x = new XMLWriter();
$x->openURI('data/file.xml');
$x->startDocument('1.0', 'UTF-8');
$x->writeElement('root');
$x->endDocument();
print '<plaintext>'.file_get_contents('data/file.xml');
?>

Expected result:
----------------
<?xml version="1.0" encoding="UTF-8"?> <root/> 

Actual result:
--------------
Warning: XMLWriter::openUri() [xmlwriter.openuri]: Unable to resolve file path in C:\localhost\www\xml.php on line 3

Warning: XMLWriter::startDocument() [xmlwriter.startdocument]: Invalid or unitialized XMLWriter object in C:\localhost\www\xml.php on line 4

Warning: XMLWriter::writeElement() [xmlwriter.writeelement]: Invalid or unitialized XMLWriter object in C:\localhost\www\xml.php on line 5

Warning: XMLWriter::endDocument() [xmlwriter.enddocument]: Invalid or unitialized XMLWriter object in C:\localhost\www\xml.php on line 6

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-07-24 17:12 UTC] jani@php.net
Since when is 'data/file.xml' a valid URI? Try with proper URI instead.
 [2009-08-01 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-02-16 09:57 UTC] afpral dot com at gmail dot com
Warning: XMLWriter::openUri() [xmlwriter.openuri]: Unable to resolve file path
With DIRECTORY_SEPARATOR uri to
not the same issue with only file name.
Parse filepath problem
 [2010-02-16 10:09 UTC] pajoye@php.net
@afpral dot com at gmail dot com 

Be sure that the directory exists (data/).
 [2010-02-24 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2010-06-13 03:35 UTC] dandandare at yahoo dot es
PHP Version: 5.3.1
OS Version: XP SP3 32bit

$xml->openURI('file.xml'); -> ok!
$xml->openURI('../file.xml'); -> ok!
$xml->openURI('xml/file.xml'); -> DON'T WORK!
$xml->openURI('../xml/file.xml'); -> DON'T WORK!

Don't work when you tries to access to a directory, why?
 [2010-10-04 14:11 UTC] ekschperte at mysc dot de
I have the same problem...XP SP3 32bit
$xml->openURI('data/file.xml'); -> DOES NOT WORK!
The code works on 5.2.9. :-(
 [2011-10-25 01:03 UTC] sinthia at fireflowdesign dot com
I am having the same problem with a relative path on windows7.
 [2016-09-09 16:38 UTC] cmb@php.net
-Status: No Feedback +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-09-09 16:38 UTC] cmb@php.net
Re-opening due to
<http://php.net/manual/en/function.xmlwriter-open-uri.php#119868>.

However, I can't reproduce this issue. Can anybody else?
 [2016-09-18 04:22 UTC] php-bugs at lists dot php dot 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 "Re-Opened". Thank you.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 09:01:28 2024 UTC