php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35416 Error reading XML-File with domxml_open_file
Submitted: 2005-11-27 01:37 UTC Modified: 2005-12-03 01:39 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: pehewa at a1 dot net Assigned:
Status: Closed Package: DOM XML related
PHP Version: 4.4.1 OS: Windows (W2K, XP)
Private report: No CVE-ID: None
 [2005-11-27 01:37 UTC] pehewa at a1 dot net
Description:
------------
System: Windows W2K or XP with Apache 2.0.54

My PHP-program exists for one year minimum without changes and runs at a provider (Version 4.4.1 - not under Windows) without errors.

A valid XML-file "nav.xml" should be read.

The error messages are after execution are:

Warning: domxml_open_file(): I/O in C:\pathtophpfile on line x
Warning: domxml_open_file(): warning in C:\pathtophpfile on line x
Warning: domxml_open_file(): failed to load external entity "nav.xml" in C:\pathtophpfile on line x

php.ini changes:
precision = 14
output_buffering = 4096
allow_call_time_pass_reference = Off
log_errors = On
error_log = C:\php_error.log
variables_order = "GPCS"
register_argc_argv = Off
magic_quotes_gpc = Off
extension_dir = "./extensions"
extension=php_domxml.dll
extension=php_xslt.dll
dbx.colnames_case = "lowercase"
session.gc_divisor = 1000
session.bug_compat_42 = 0
url_rewriter.tags = "a=href,area=href,frame=src,input=src,form=fakeentry"


Loaded Modules out of the phpinfo():
core mod_win32 mpm_winnt http_core mod_so mod_access mod_actions mod_alias mod_asis mod_auth mod_autoindex mod_cgi mod_dav mod_dir mod_env mod_imap mod_include mod_isapi mod_log_config mod_mime mod_negotiation mod_setenvif mod_userdir mod_dav_svn mod_authz_svn sapi_apache2

Reproduce code:
---------------
$navdoc = domxml_open_file("nav_xml");

File nav.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<navigation>
<items>
<item parent="00">
<change>15.10.2005</change>
</item>
</items>
</navigation>

Expected result:
----------------
Getting the correct result (XML-Document Object) as on other Systems with PHP 4.4.1 or on Windows-Systems with PHP 4.3.2.



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-27 18:46 UTC] tony2001@php.net
$navdoc = domxml_open_file("nav_xml");
"nav_xml" looks obviously wrong, as the file is called "nav.xml".
 [2005-11-27 19:17 UTC] pehewa at a1 dot net
Sorry for making this essential mistake in my first bugreport. The line code should be:

$navdoc = domxml_open_file("nav.xml");
 [2005-11-27 19:25 UTC] tony2001@php.net
What if you try to use absolute path for nav.xml?
 [2005-12-03 01:39 UTC] pehewa at a1 dot net
Thank you. I have tried your proposal - and it is running. So I have written a workaround for this problem - using the same code for Windows and Linux with Apache:

function docpath () {  
   // Get some information about the server software
  $software = $_SERVER['SERVER_SOFTWARE'];
  $win = strpos ($software, "Win32");
  
  // Decides, running on a Windows system or not
  if ( $win > 0 ) {
    // Adds the absolute path
    $filename = $_SERVER['SCRIPT_FILENAME'];
    $pos = strrpos($filename, "/") + 1;
    $filepath = substr( $filename, 0, $pos );
  } else {
    $filepath = "";
  }
  return ($filepath);
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun May 12 16:01:35 2024 UTC