From e208b0e77edbb74065ba7079884127af7c90fd9b Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Sun, 15 Jun 2003 23:57:48 +0000 Subject: [PATCH] Add an error handler (thx to timm for the idea) --- ext/dom/php_dom.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index e205e36728..67b528e2d1 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -284,6 +284,20 @@ zend_module_entry dom_module_entry = { ZEND_GET_MODULE(dom) #endif +/* {{{ _phpXmlParserErrorCb */ +static void _phpXmlParserErrorCb(void *ctx, const char *msg, ...) { + va_list ap; + char *buf; + TSRMLS_FETCH(); + + va_start(ap, msg); + vspprintf(&buf, 0, msg, ap); + va_end(ap); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", buf); + efree(buf); +} +/* }}} */ + /* {{{ PHP_MINIT_FUNCTION(dom) */ PHP_MINIT_FUNCTION(dom) { @@ -520,6 +534,7 @@ PHP_MINIT_FUNCTION(dom) REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS | CONST_PERSISTENT); xmlInitParser(); + xmlSetGenericErrorFunc((void*) NULL, _phpXmlParserErrorCb); return SUCCESS; } -- 2.40.0