From: Rob Richards Date: Sun, 20 Feb 2005 22:01:24 +0000 (+0000) Subject: use new error handling when not throwing exceptions X-Git-Tag: RELEASE_0_3~304 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=8913ddc295e8ca91a84d7a3959ada6893dac35ea;p=php use new error handling when not throwing exceptions --- diff --git a/ext/dom/domexception.c b/ext/dom/domexception.c index 538bc682b6..e5092a21fc 100644 --- a/ext/dom/domexception.c +++ b/ext/dom/domexception.c @@ -41,6 +41,16 @@ zend_function_entry php_dom_domexception_class_functions[] = { {NULL, NULL, NULL} }; +/* {{{ php_dom_throw_error_with_message */ +void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC) +{ + if (strict_error == 1) { + zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC); + } else { + php_libxml_issue_error(E_WARNING, error_message TSRMLS_CC); + } +} + /* {{{ php_dom_throw_error */ void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC) { @@ -100,11 +110,7 @@ void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC) error_message = "Unhandled Error"; } - if (strict_error == 1) { - zend_throw_exception(dom_domexception_class_entry, error_message, error_code TSRMLS_CC); - } else { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", error_message); - } + php_dom_throw_error_with_message(error_code, error_message, strict_error TSRMLS_CC); } /* }}} end php_dom_throw_error */ diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index a8ee2b95aa..eb17dc5154 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -91,6 +91,7 @@ zend_object_value dom_xpath_objects_new(zend_class_entry *class_type TSRMLS_DC); #endif int dom_get_strict_error(php_libxml_ref_obj *document); void php_dom_throw_error(int error_code, int strict_error TSRMLS_DC); +void php_dom_throw_error_with_message(int error_code, char *error_message, int strict_error TSRMLS_DC); void node_list_unlink(xmlNodePtr node TSRMLS_DC); int dom_check_qname(char *qname, char **localname, char **prefix, int uri_len, int name_len); xmlNsPtr dom_get_ns(xmlNodePtr node, char *uri, int *errorcode, char *prefix);