Bug 298031

Summary: PHP DOM XML (libxml) suddenly fails to read files
Product: Red Hat Enterprise Linux 5 Reporter: Bart de Boer <bart.deboer>
Component: phpAssignee: Joe Orton <jorton>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: low    
Version: 5.0   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: RHBA-2008-0327 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2008-05-21 14:31:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bart de Boer 2007-09-20 12:40:01 UTC
Description of problem:

PHP suddenly fails to read remote and local files through libxml. The behaviour
is erratic. It has happened twice. Then after a while everything suddenly works
as expected again. 

Version-Release number of selected component (if applicable):

PHP 5.1.6

How reproducible:

$doc = new DOMDocument();
$doc->load('some_xml_file.xml');
echo $doc->saveXML();

Steps to Reproduce:

This is a tough one since it's erratic. The problem persisted after restarting
apache and rebooting the entire system. Then the problem went away without me
doing anything. 

1. Run Soap webservices and Soap clients
2. Read local files through DOM XML.
  
Actual results:

Warning: DOMDocument::load(): supplied argument is not a valid Stream-Context
resource in

Expected results:

display the XML.

Additional info:

The following form thread describes the same problem:

http://www.phparch.com/discuss/index.php/t/3269/d462c1c5f7641301d39e52a2b5e0e4fb/

It also has an answer to the problem. However I couldn't find specifics about
it. quoting:

"This problem is fixed in 5.2. When using libxml_set_streams_context, the
context was never destroyed for the process when the request terminated so would
remain for every request made within the process. As far as ext/soap goes, it
can create an xml stream context when needed. It does look like there is a case
within the code that it could error out (extra-ordinary circumstance) and
ext/soap does not reset the context back to its original state (needs to be fixed).

If this is a continual issue for you, upgrade to 5.2 (where the context is reset
at the end of every request) or make sure you manually reset the xml context
(using the method you are currently using) before your script terminates.

Rob"

Comment 1 Joe Orton 2007-10-23 20:18:59 UTC
It's a little tricky to work out exactly what fix upstream this corresponds to;
can you try out the test packages from here:

http://people.redhat.com/~jorton/Tikanga-php/

(note, untested by Red Hat QA, no warranty, etc!)

Comment 2 Bart de Boer 2007-10-25 07:47:38 UTC
Hi Joe, thank you for the response. We could install those packages. However we
have no way to test them since we're still unsure what triggered the bug and
unable to reproduce the situation. I'll discuss here and get back on it. 

We did learn later that there was a IPv6 malfunction on the network that day. I
suspect this somehow triggered something in our SOAP requests, messing up the
entire PHP stream context. 

Comment 4 RHEL Program Management 2007-12-12 16:14:39 UTC
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release.  Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products.  This request is not yet committed for inclusion in an Update
release.

Comment 9 errata-xmlrpc 2008-05-21 14:31:43 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2008-0327.html