summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2020-06-25 15:24:01 +0200
committerNikita Popov <nikita.ppv@gmail.com>2020-06-25 15:24:35 +0200
commitc9bc7dd110714be7d6d6e73184e21280f3896816 (patch)
treecf6e358118d095e5f0f9db67b01b11acf1a3a634
parent049467d365bd090a507f4cf26ee6907a59833887 (diff)
downloadphp-git-c9bc7dd110714be7d6d6e73184e21280f3896816.tar.gz
Don't throw warning if exception thrown during dom validation
-rw-r--r--ext/dom/document.c4
-rw-r--r--ext/libxml/libxml.c4
-rw-r--r--ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt4
3 files changed, 6 insertions, 6 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c
index 89f6358775..aa1d99ebd2 100644
--- a/ext/dom/document.c
+++ b/ext/dom/document.c
@@ -1681,7 +1681,9 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type
sptr = xmlSchemaParse(parser);
xmlSchemaFreeParserCtxt(parser);
if (!sptr) {
- php_error_docref(NULL, E_WARNING, "Invalid Schema");
+ if (!EG(exception)) {
+ php_error_docref(NULL, E_WARNING, "Invalid Schema");
+ }
RETURN_FALSE;
}
diff --git a/ext/libxml/libxml.c b/ext/libxml/libxml.c
index 85eaf7a026..d77f6aa2fd 100644
--- a/ext/libxml/libxml.c
+++ b/ext/libxml/libxml.c
@@ -485,7 +485,6 @@ static void php_libxml_internal_error_handler(int error_type, void *ctx, const c
char *buf;
int len, len_iter, output = 0;
-
len = vspprintf(&buf, 0, *msg, ap);
len_iter = len;
@@ -502,7 +501,8 @@ static void php_libxml_internal_error_handler(int error_type, void *ctx, const c
if (output == 1) {
if (LIBXML(error_list)) {
_php_list_set_error_structure(NULL, ZSTR_VAL(LIBXML(error_buffer).s));
- } else {
+ } else if (!EG(exception)) {
+ /* Don't throw additional notices/warnings if an exception has already been thrown. */
switch (error_type) {
case PHP_LIBXML_CTX_ERROR:
php_libxml_ctx_error_level(E_WARNING, ctx, ZSTR_VAL(LIBXML(error_buffer).s));
diff --git a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
index ea0764f980..70aa9ceaa4 100644
--- a/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
+++ b/ext/libxml/tests/libxml_set_external_entity_loader_error1.phpt
@@ -20,9 +20,7 @@ try {
}
echo "Done.\n";
---EXPECTF--
+--EXPECT--
bool(true)
-
-Warning: DOMDocument::validate(): Could not load the external subset "http://example.com/foobar" in %s on line %d
Exception: Too few arguments to function {closure}(), 3 passed and exactly 4 expected
Done.