php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #65365 Allow defining baseURI of doc not loaded directly from URL
Submitted: 2013-07-31 05:49 UTC Modified: 2013-07-31 05:51 UTC
From: mike at skew dot org Assigned:
Status: Open Package: DOM XML related
PHP Version: 5.4.17 OS: FreeBSD 8.4-RELEASE
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: mike at skew dot org
New email:
PHP Version: OS:

 

 [2013-07-31 05:49 UTC] mike at skew dot org
Description:
------------
As I noted in Request #65364, when loading an XML document from memory (string, 
file, whatever), such as via DOMDocument::loadXml(), PHP tells libxml to use a 
particular default value as the base URI, and this value is then exposed through 
the baseURI property in the DOM.

It's quite possible that the XML has been cached or otherwise came from 
somewhere that's known, and the app will want to use a particular URL as the 
base URI at parse time. It would be nice, then, when the app does get around to 
parsing, for it to see the same baseURI properties as if DOMDocument::load() had 
been used with the original URL.

So, regardless of what the default base URI is, PHP should provide a way to 
override it at parse time. I suggest allowing loadXml() to take another 
argument: a string for the base URI.

This will help with using the baseURI property for what is ostensibly its 
purpose: resolving relative URI references in the document, such as href values 
in XHTML documents and Atom feeds.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-07-31 05:51 UTC] mike at skew dot org
-Summary: baseURI should always be a real URI +Summary: Allow defining baseURI of doc not loaded directly from URL
 [2013-07-31 05:51 UTC] mike at skew dot org
Fixed summary (request title).
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 11:01:28 2024 UTC