Skip to content

Commit

Permalink
Don't throw warning if exception thrown during dom validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Jun 25, 2020
1 parent 049467d commit c9bc7dd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 3 additions & 1 deletion ext/dom/document.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
4 changes: 2 additions & 2 deletions ext/libxml/libxml.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit c9bc7dd

Please sign in to comment.