php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53369 Context parameter for simplexml_load_file and SimpleXMLElement::__construct
Submitted: 2010-11-21 11:28 UTC Modified: 2010-12-01 15:19 UTC
Votes:5
Avg. Score:4.0 ± 0.6
Reproduced:4 of 4 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: juwe at clasennet dot de Assigned:
Status: Open Package: SimpleXML related
PHP Version: * OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2010-11-21 11:28 UTC] juwe at clasennet dot de
Description:
------------
A lot of the file/stream accessing functions have a context parameter.

In contrast, SimpleXMLElement::__construct() and simplexml_load_file() do not.

Both are able to use other contexts though, since you can change the context in use using libxml_set_streams_context(). 

The problem with that is, that future requests using any of the other xml extensions are affected as well by using the function mentioned above. 

In the interest of a consistent interface and a minimized risk to break things, it would be nice to see a context parameter for the SimpleXMLElement::__construct() and simplexml_load_file().

Furthermore a hint in the manual entries for both functions to libxml_set_streams_context() or contexts in general would be good.

I just spend a number of hours debugging my code, and the error turned out to be a missing context reset in a class from somebody else... :(



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-01 15:19 UTC] jani@php.net
-PHP Version: Irrelevant +PHP Version: *
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Wed Jul 24 07:01:26 2019 UTC