php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39823 DOMDocument::load() trims off end of include path
Submitted: 2006-12-13 22:59 UTC Modified: 2006-12-15 09:57 UTC
From: esayre at olemiss dot edu Assigned:
Status: Not a bug Package: DOM XML related
PHP Version: 5.2.0 OS: Red Hat Enterprise Linux 3
Private report: No CVE-ID: None
 [2006-12-13 22:59 UTC] esayre at olemiss dot edu
Description:
------------
While trying to load an XML document into a PHP script that 
runs through the CLI I ran into the following error.

PHP Warning:  DOMDocument::load(): I/O warning : failed to 
load external entity "/var/www/GrahamCracker/FARIntegration/
ORSPRequestTemplate.xml" in /var/www/code/GrahamCracker/
FARIntegration/SynchronizeDatabases.php on line 126
PHP Fatal error:  Call to a member function appendChild() on a 
non-object in /var/www/code/GrahamCracker/FARIntegration/
SynchronizeDatabases.php on line 132

The include path was set properly as "/var/www/code" but the 
DOMDocument::load() method tried to use "/var/www" which is 
not listed in the include path.

Actual result:
--------------
PHP Warning:  DOMDocument::load(): I/O warning : failed to 
load external entity "/var/www/GrahamCracker/FARIntegration/
ORSPRequestTemplate.xml" in /var/www/code/GrahamCracker/
FARIntegration/SynchronizeDatabases.php on line 126
PHP Fatal error:  Call to a member function appendChild() on a 
non-object in /var/www/code/GrahamCracker/FARIntegration/
SynchronizeDatabases.php on line 132

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-14 05:42 UTC] chregu@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.


 [2006-12-14 14:05 UTC] smlerman at gmail dot com
Unless it has changed in 5.2, DOMDocument->load() doesn't use include_path. You have to give it an absolute path or a path relative to the current working directory.
 [2006-12-14 15:30 UTC] esayre at olemiss dot edu
Thank you for that, I looked in the documentation to see if 
that was the fact, but could not find it in the documentation.

That raises another question though, as my script's working 
directory should have been /var/www/code/DataGeneral/
ChronicMan/ and not /var/www...

I had already resolved my problem by simply using an absolute 
path, however if helpful I can continue investigating this.
 [2006-12-15 09:57 UTC] tony2001@php.net
None of the I/O functions use include_path unless it's specified explicitly.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Nov 23 02:01:31 2024 UTC