|  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
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
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.
Block user comment
Status: Assign to:
Bug Type:
From: juwe at clasennet dot de
New email:
PHP Version: OS:


 [2010-11-21 11:28 UTC] juwe at clasennet dot de
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... :(


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-01 15:19 UTC]
-PHP Version: Irrelevant +PHP Version: *
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Sat May 15 12:01:23 2021 UTC