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: 2021-09-09 14:29 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: Suspended Package: SimpleXML related
PHP Version: * OS:
Private report: No CVE-ID: None
 [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

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-12-01 15:19 UTC] jani@php.net
-PHP Version: Irrelevant +PHP Version: *
 [2021-09-09 14:29 UTC] cmb@php.net
-Status: Open +Status: Suspended
 [2021-09-09 14:29 UTC] cmb@php.net
> Furthermore a hint in the manual entries for both functions to
> libxml_set_streams_context() or contexts in general would be good.

Done[1].

Wrt. the feature request, I suggest to pursue the RFC process[2];
otherwise it's likely that this ticket will be unaddressed for
another ten years.  For the time being, I suspend it.

[1] <https://github.com/php/doc-en/commit/6199e10e916fbd656632d677dbf96569328b9b3b>
[2] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Dec 30 14:01:28 2024 UTC