|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Dec 03 22:00:01 2025 UTC |
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?I have the same problem...XP SP3 32bit $xml->openURI('data/file.xml'); -> DOES NOT WORK! The code works on 5.2.9. :-(