title: DOMDocument->load() I/O warning : failed to load external entity
body: <p>On PHP 5.3.3-7, I'm using DOMDocument->load() to load a local file, and recently I've started encountering situations where I start getting E_WARNINGs</p>
  
  <pre><code> DOMDocument::load() [domdocument.load]: I/O warning : failed to load external entity "/path/to/local/file/that/does/exist"
  </code></pre>
  
  <p>Once this starts happening the only way I've found to make the errors stop is to restart apache, and then it's fine for a while again.</p>
  
  <p>I haven't changed any related code recently, but it occurred to me that this started happening after I installed a Debian patch for <a href="http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2013-1643" rel="nofollow">CVE-2013-1643</a>, which seems to possibly disable entity loading... if there's a single instance of an event that would trigger disabling, could that disable it permanently for all future PHP requests until a restart?  That seems aggressive.  By contrast, libxml_disable_entity_loader() seems to operate on the current request only.</p>
  
  <p>I have no code that I know of that should ever load remote XML and that would ever trigger disabling, but if this is what's happening, I would have expected something to show up in my php error log, but I don't see anything.  What other avenues should I investigate?</p>
  
  <p><strong>EDIT</strong>: Finally, I've been able to predictably repeat the problem.  If I intentionally exceed the allowed memory limit in a single session...</p>
  
  <pre><code>mod_fcgid: stderr: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes)
  </code></pre>
  
  <p>...then I start getting the I/O warning on all subsequent calls to DOMDocument->load().  This time, I was able to get it working again without restarting apache... just by calling libxml_disable_entity_loader(false).  This is truly funky behavior--it's starting to smell like a bug in php?</p>