]> granicus.if.org Git - php/commit
Fix #71592: External entity processing never fails
authorChristoph M. Becker <cmbecker69@gmx.de>
Sat, 27 Oct 2018 15:30:13 +0000 (17:30 +0200)
committerChristoph M. Becker <cmbecker69@gmx.de>
Sat, 27 Oct 2018 15:30:13 +0000 (17:30 +0200)
commit829b0df77b20392115d75fb82c56ad94edc1e423
tree2fc5e0de728e33f8cc4bc84effcada045689ca54
parentbca0a7e2850e50c965ac2e6cb9065e978ac5a9e2
Fix #71592: External entity processing never fails

If the callback set via `xml_set_external_entity_ref_handler()` returns
a falsy value, parsing is supposed to stop and the error number set to
`XML_ERROR_EXTERNAL_ENTITY_HANDLING`.  This is already correctly done
by the libexpat binding, but the libxml2 binding ignores the return
value.  We fix this by calling `xmlStopParser()` which is available as
of libxml 2.1.0[1] (PHP-7.1 requires at least libxml 2.6.11 anyway),
and setting the desired `errNo` ourselves.

[1] <http://xmlsoft.org/news.html>
NEWS
UPGRADING
ext/xml/compat.c
ext/xml/tests/bug71592.phpt [new file with mode: 0644]