cvs: php4 /ext/dom php_dom.c
| From: | Marcus Boerger | Date: | Sun, 15 Jun 2003 23:57:48 +0000 |
| Subject: | cvs: php4 /ext/dom php_dom.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-21765@lists.php.net to get a copy of this message | ||
helly Sun Jun 15 19:57:48 2003 EDT
Modified files:
/php4/ext/dom php_dom.c
Log:
Add an error handler (thx to timm for the idea)
Index: php4/ext/dom/php_dom.c
diff -u php4/ext/dom/php_dom.c:1.13 php4/ext/dom/php_dom.c:1.14
--- php4/ext/dom/php_dom.c:1.13 Sun Jun 15 15:58:42 2003
+++ php4/ext/dom/php_dom.c Sun Jun 15 19:57:48 2003
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: php_dom.c,v 1.13 2003/06/15 19:58:42 rrichards Exp $ */
+/* $Id: php_dom.c,v 1.14 2003/06/15 23:57:48 helly Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -284,6 +284,20 @@
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 @@
REGISTER_LONG_CONSTANT("XML_ATTRIBUTE_NOTATION", XML_ATTRIBUTE_NOTATION, CONST_CS |
CONST_PERSISTENT);
xmlInitParser();
+ xmlSetGenericErrorFunc((void*) NULL, _phpXmlParserErrorCb);
return SUCCESS;
}