diff options
author | Aaron Piotrowski <aaron@trowski.com> | 2016-07-05 02:08:39 -0500 |
---|---|---|
committer | Aaron Piotrowski <aaron@trowski.com> | 2016-07-05 02:08:39 -0500 |
commit | 24237027bc7e4f7aed9287fe9815c0577eeb1c22 (patch) | |
tree | bc23b05ba89a75f0e0711933371f708b96e63345 /ext/dom | |
parent | 42666da1714673d537356221e688f57f404fe1d2 (diff) | |
parent | e9832b5ab1d986ddd3ea0705bcbc5a391dc16614 (diff) | |
download | php-git-24237027bc7e4f7aed9287fe9815c0577eeb1c22.tar.gz |
Merge branch 'throw-error-in-extensions'
Diffstat (limited to 'ext/dom')
-rw-r--r-- | ext/dom/document.c | 14 | ||||
-rw-r--r-- | ext/dom/php_dom.c | 9 | ||||
-rw-r--r-- | ext/dom/php_dom.h | 2 |
3 files changed, 10 insertions, 15 deletions
diff --git a/ext/dom/document.c b/ext/dom/document.c index 30d9c13ee9..70289cf54a 100644 --- a/ext/dom/document.c +++ b/ext/dom/document.c @@ -1856,7 +1856,7 @@ static void _dom_document_schema_validate(INTERNAL_FUNCTION_PARAMETERS, int type vptr = xmlSchemaNewValidCtxt(sptr); if (!vptr) { xmlSchemaFree(sptr); - php_error(E_ERROR, "Invalid Schema Validation Context"); + zend_throw_error(NULL, "Invalid Schema Validation Context"); RETURN_FALSE; } @@ -1956,7 +1956,7 @@ static void _dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAMETERS, int typ vptr = xmlRelaxNGNewValidCtxt(sptr); if (!vptr) { xmlRelaxNGFree(sptr); - php_error(E_ERROR, "Invalid RelaxNG Validation Context"); + zend_throw_error(NULL, "Invalid RelaxNG Validation Context"); RETURN_FALSE; } @@ -2244,15 +2244,11 @@ PHP_METHOD(domdocument, registerNodeClass) if (ce == NULL || instanceof_function(ce, basece)) { DOM_GET_OBJ(docp, id, xmlDocPtr, intern); - - if (dom_set_doc_classmap(intern->document, basece, ce) == FAILURE) { - php_error_docref(NULL, E_ERROR, "Class %s could not be registered.", ZSTR_VAL(ce->name)); - } + dom_set_doc_classmap(intern->document, basece, ce); RETURN_TRUE; - } else { - php_error_docref(NULL, E_ERROR, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name)); } - + + zend_throw_error(NULL, "Class %s is not derived from %s.", ZSTR_VAL(ce->name), ZSTR_VAL(basece->name)); RETURN_FALSE; } /* }}} */ diff --git a/ext/dom/php_dom.c b/ext/dom/php_dom.c index 68a8d3a802..9879d81c1c 100644 --- a/ext/dom/php_dom.c +++ b/ext/dom/php_dom.c @@ -206,7 +206,7 @@ static void dom_copy_doc_props(php_libxml_ref_obj *source_doc, php_libxml_ref_ob } } -int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce) +void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce) { dom_doc_propsptr doc_props; @@ -214,7 +214,7 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, doc_props = dom_get_doc_props(document); if (doc_props->classmap == NULL) { if (ce == NULL) { - return SUCCESS; + return; } ALLOC_HASHTABLE(doc_props->classmap); zend_hash_init(doc_props->classmap, 0, NULL, NULL, 0); @@ -225,7 +225,6 @@ int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_hash_del(doc_props->classmap, basece->name); } } - return SUCCESS; } zend_class_entry *dom_get_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece) @@ -286,7 +285,7 @@ PHP_DOM_EXPORT dom_object *php_dom_object_get_data(xmlNodePtr obj) /* {{{ dom_read_na */ static int dom_read_na(dom_object *obj, zval *retval) { - php_error_docref(NULL, E_ERROR, "Cannot read property"); + zend_throw_error(NULL, "Cannot read property"); return FAILURE; } /* }}} */ @@ -294,7 +293,7 @@ static int dom_read_na(dom_object *obj, zval *retval) /* {{{ dom_write_na */ static int dom_write_na(dom_object *obj, zval *newval) { - php_error_docref(NULL, E_ERROR, "Cannot write property"); + zend_throw_error(NULL, "Cannot write property"); return FAILURE; } /* }}} */ diff --git a/ext/dom/php_dom.h b/ext/dom/php_dom.h index 2c9f1cc656..d0329ac2ed 100644 --- a/ext/dom/php_dom.h +++ b/ext/dom/php_dom.h @@ -125,7 +125,7 @@ xmlNodePtr create_notation(const xmlChar *name, const xmlChar *ExternalID, const xmlNode *php_dom_libxml_hash_iter(xmlHashTable *ht, int index); xmlNode *php_dom_libxml_notation_iter(xmlHashTable *ht, int index); zend_object_iterator *php_dom_get_iterator(zend_class_entry *ce, zval *object, int by_ref); -int dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce); +void dom_set_doc_classmap(php_libxml_ref_obj *document, zend_class_entry *basece, zend_class_entry *ce); zval *dom_nodelist_read_dimension(zval *object, zval *offset, int type, zval *rv); int dom_nodelist_has_dimension(zval *object, zval *member, int check_empty); |