Thanks to visit codestin.com
Credit goes to github.com

Skip to content

XmlDriver: Avoid PHP bug #62577 by avoiding simplexml_load_file.#6633

Merged
Ocramius merged 1 commit into
doctrine:masterfrom
apapsch:master
Aug 18, 2017
Merged

XmlDriver: Avoid PHP bug #62577 by avoiding simplexml_load_file.#6633
Ocramius merged 1 commit into
doctrine:masterfrom
apapsch:master

Conversation

@apapsch
Copy link
Copy Markdown

@apapsch apapsch commented Aug 18, 2017

Doctrine is affected by PHP bug #62577. simplexml_load_file is not
able to load files if libxml_disable_entity_loader(true) has been
called. simplexml_load_file fails with the message:

I/O warning : failed to load external entity "/my/mappings/my_entity.dcm.xml"
in /path-to/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 711

This error occurs even if there are no external entities in the XML file.

Waiting for the PHP bug to be resolved is infeasible, because it is
unresolved since years. Therefore Doctrine needs to circumvent the bug
by replacing simplexml_load_file with simplexml_load_string while getting
the file contents itself. simplexml_load_string is not affected by the
PHP bug.

Doctrine is affected by PHP bug #62577. simplexml_load_file is not
able to load files if libxml_disable_entity_loader(true) has been
called. simplexml_load_file fails with the message:

I/O warning : failed to load external entity "/my/mappings/my_entity.dcm.xml"
in /path-to/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php on line 711

This error occurs even if there are no external entities in the XML file.

Waiting for the PHP bug to be resolved is infeasible, because it is
unresolved since years. Therefore Doctrine needs to circumvent the bug
by replacing simplexml_load_file with simplexml_load_string while getting
the file contents itself. simplexml_load_string is not affected by the
PHP bug.
@apapsch
Copy link
Copy Markdown
Author

apapsch commented Aug 18, 2017

This would solve #3788 .

@Ocramius Ocramius added the Bug label Aug 18, 2017
@Ocramius Ocramius self-assigned this Aug 18, 2017
@Ocramius Ocramius added this to the 2.5.10 milestone Aug 18, 2017
Ocramius added a commit that referenced this pull request Aug 18, 2017
…s-in-xml-mapping-driver-2.5' into 2.5

Backport #6633
Backport #3788
@Ocramius Ocramius merged commit eb762de into doctrine:master Aug 18, 2017
Ocramius added a commit that referenced this pull request Aug 18, 2017
@Ocramius
Copy link
Copy Markdown
Member

Merged, thanks @apapsch!

master: a426808
2.5: fb7b78c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants