mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
XmlDriver: simplexml_load_file is unreliable, should be avoided #5641
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @apapsch on GitHub (Aug 14, 2017).
Originally assigned to: @Ocramius on GitHub.
XmlDriver uses SimpleXml which is not reliable to load files. Sometimes SimpleXml may successfully load file, sometimes fail with:
Doctrine subsequently throws exception, whose message is somewhat misleading, as the complained about file exists and is perfectly valid:
[1] suggests that is has to do with SimpleXml thread issues. I'm ever more suspicious because entity files are affected which haven't changed in months.
To fix this issue short-term applications may call
libxml_disable_entity_loader(false);, but applications shouldn't need to care about the XML reader Doctrine uses internally. As [1] suggests as solution, users of SimpleXml should avoid SimpleXml functions which operate on files, e.g. replacesimplexml_load_file(...)withsimplexml_load_string(file_get_contents(...)).[1] https://stackoverflow.com/questions/20534866/intermittent-simplexml-load-file-i-o-warning-on-local-joomla-site
@Ocramius commented on GitHub (Aug 14, 2017):
Duplicate of https://github.com/doctrine/doctrine2/issues/3788