Let me put it here just in case for somebody will google for an answer and the solution with not thread-safe libxml_disable_entity_loader(false)
will not be applicable. The potential vulnerability of enabling the entity loader system-wide is shown below:
<!DOCTYPE scan [<!ENTITY test SYSTEM
"php://filter/read=convert.base64-encode/resource=/etc/passwd">]>
<scan>&test;</scan>
The problem caused by the lack of thread safety is explained here. Although one might either register her own entity loader with libxml_set_external_entity_loader
, or use locks to protect calls to libxml_disable_entity_loader
, these solutions seem a bit puzzling.
The good news is that the problem with external entities affects only the functions dealing with files (e.g. simplexml_load_file
, DOMDocument::schemaValidate
and like). That makes the solution straight and simple. First load file content as string and then execute the respective libxml string-oriented function.
simplexml_load_string(file_get_contents($xml));
and/or
$xml = new DOMDocument('1.0', 'UTF8');
$xml->loadXML(file_get_contents($xmlFile));
$xml->schemaValidateSource(file_get_contents($xsdFile));
Hope it helps somebody.
I/O warning
sounds like it could be a system/hardware issue perhaps? Maybe a full hard disk or something?