diff --git a/ext/xsl/tests/bug33853.phpt b/ext/xsl/tests/bug33853.phpt
index a2e835ff6d4..815ea03a257 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 6693ac40216..968ed2f3d7f 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));