From: Nikita Popov Date: Thu, 25 Jun 2020 13:06:53 +0000 (+0200) Subject: Avoid warning on exception in xsl ext X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=049467d365bd090a507f4cf26ee6907a59833887;p=php Avoid warning on exception in xsl ext --- diff --git a/ext/xsl/tests/bug33853.phpt b/ext/xsl/tests/bug33853.phpt index a2e835ff6d..815ea03a25 100644 --- a/ext/xsl/tests/bug33853.phpt +++ b/ext/xsl/tests/bug33853.phpt @@ -9,8 +9,8 @@ if (getenv('SKIP_ASAN')) die('xfail bailing out across foreign C code'); +--FILE-- +loadXML(' + + + + +'); +$inputdom = new DomDocument(); +$inputdom->loadXML(' +'); + +$proc = new XsltProcessor(); +$proc->registerPhpFunctions(); +$xsl = $proc->importStylesheet($xsl); +try { + $newdom = $proc->transformToDoc($inputdom); +} catch (Exception $e) { + echo $e->getMessage(), "\n"; +} +?> +===DONE=== +--EXPECT-- +string(4) "TeSt" +Autoload exception +===DONE=== diff --git a/ext/xsl/xsltprocessor.c b/ext/xsl/xsltprocessor.c index 6693ac4021..968ed2f3d7 100644 --- a/ext/xsl/xsltprocessor.c +++ b/ext/xsl/xsltprocessor.c @@ -248,7 +248,9 @@ static void xsl_ext_function_php(xmlXPathParserContextPtr ctxt, int nargs, int t fci.no_separation = 0; /*fci.function_handler_cache = &function_ptr;*/ if (!zend_make_callable(&handler, &callable)) { - php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable)); + if (!EG(exception)) { + php_error_docref(NULL, E_WARNING, "Unable to call handler %s()", ZSTR_VAL(callable)); + } valuePush(ctxt, xmlXPathNewString((const xmlChar *) "")); } else if ( intern->registerPhpFunctions == 2 && zend_hash_exists(intern->registered_phpfunctions, callable) == 0) { php_error_docref(NULL, E_WARNING, "Not allowed to call handler '%s()'", ZSTR_VAL(callable));