PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » XML » XML_Parser » Bug #2458

Put allow_url_fopen back in original state when opening from URL

Details

Request #2458Put allow_url_fopen back in original state when opening from URL
Submitted2004-10-05 09:42 UTC
Fromleond at summitmedia dot co dot uk
Assignedschst
StatusClosed
PackageXML_Parser
PHP Version4.3.4
OSAll
Roadmaps(Not assigned)

Comments

[2004-10-05 09:42 UTC] leond at summitmedia dot co dot uk

Description:
------------
Was looking through XML/Parser.php and noticed that it set
allow_url_fopen on but didn't reset it afterwards, possibly allowing anything after the inclusion of Parser.php to use fopen wrappers even if php.ini had them turned off. This patch gets the state of allow_url_fopen and restores it after the call to fopen(). Diff below based on XML_Parser-1.2.1

Reproduce code:
---------------
380c380,383
< ini_set('allow_url_fopen', 1);
---
> $allow_fopen = (ini_get('allow_url_fopen') == '1');
> if (!$allow_fopen) {
> ini_set('allow_url_fopen', 1);
> }
386a390,392
> if (!$allow_fopen) {
> ini_set('allow_url_fopen', 0);
> }

Expected result:
----------------
This should pick up the state of allow_url_fopen; if it is disabled, it will be temporarily enabled to allow the fopen call to work, and then turned back off so that the rest of the script executes with fopen() disabled