php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71497 DOMDocument::documentURI incorrect path converting
Submitted: 2016-02-02 08:36 UTC Modified: 2024-03-09 16:12 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: pvlgood at gmail dot com Assigned: nielsdos (profile)
Status: Closed Package: DOM XML related
PHP Version: 5.6.17 OS: Windows 8.1
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: pvlgood at gmail dot com
New email:
PHP Version: OS:

 

 [2016-02-02 08:36 UTC] pvlgood at gmail dot com
Description:
------------
See code sample below

Test script:
---------------
<?php
$dd = new DOMDocument();
$dd->load('folder/file.xml');
echo $dd->documentURI;
echo file_exists($dd->documentURI);

/*
output:
file:/D:/folder/file.xml
false

should be:
file://D:/folder/file.xml
true
*/


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-02-02 09:03 UTC] pvlgood at gmail dot com
-Package: Doc Build problem +Package: DOM XML related
 [2016-02-02 09:03 UTC] pvlgood at gmail dot com
sorry
 [2016-02-04 14:46 UTC] eaton dot alf at gmail dot com
This is also a problem when trying to load an XML file with a DTD: the path to the DTD file in the XML catalog is parsed incorrectly (converting "file:///" to "file:/"), so the DTD can't be loaded (the error given is "failed to load external entity").

This may be a libxml2 bug, as it broke between libxml versions 1.9.1 and 1.9.2, although the xmllint command line tool is still able to correctly load the DTD.
 [2024-03-09 16:12 UTC] nielsdos@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: nielsdos
 [2024-03-09 16:12 UTC] nielsdos@php.net
The fix for this bug has been committed.
If you are still experiencing this bug, try to check out latest source from https://github.com/php/php-src and re-test.
Thank you for the report, and for helping us make PHP better.

This is fixed in the new opt-in spec-compliance mode, which was merged in https://github.com/php/php-src/pull/13031.
For more information about the opt-in mode, please see https://wiki.php.net/rfc/opt_in_dom_spec_compliance.
In short: the behaviour of the old DOM classes are unaffected for backwards-compatibility reasons. There are new DOM classes where your code is correctly handled.
This feature will be available in PHP 8.4.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 12:01:29 2024 UTC