diff options
author | Nikita Popov <nikic@php.net> | 2015-04-02 18:52:32 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2015-04-06 11:27:34 +0200 |
commit | 122d759618a42bff105971b923fbbb5be02e34b9 (patch) | |
tree | fd4487414ffa3f120c77b19b9eb7dc409659c57e /ext/dom/documentfragment.c | |
parent | 884b0365dbe718f667d048dbc3d1cd9d9f12ab84 (diff) | |
download | php-git-122d759618a42bff105971b923fbbb5be02e34b9.tar.gz |
Always throw TypeException on throwing zpp failures
Introduces a ZEND_PARSE_PARAMS_THROW flag for zpp, which forces to
report FAILURE errors using a TypeException instead of a Warning,
like it would happen in strict mode.
Adds a zend_parse_parameters_throw() convenience function, which
invokes zpp with this flag.
Converts all cases I could identify, where we currently have
throwing zpp usage in constructors and replaces them with this API.
Error handling is still replaced to EH_THROW in some cases to handle
other, domain-specific errors in constructors.
Diffstat (limited to 'ext/dom/documentfragment.c')
-rw-r--r-- | ext/dom/documentfragment.c | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/ext/dom/documentfragment.c b/ext/dom/documentfragment.c index 31d3065f50..9cf0fd5423 100644 --- a/ext/dom/documentfragment.c +++ b/ext/dom/documentfragment.c @@ -53,18 +53,14 @@ const zend_function_entry php_dom_documentfragment_class_functions[] = { PHP_METHOD(domdocumentfragment, __construct) { - zval *id; + zval *id = getThis(); xmlNodePtr nodep = NULL, oldnode = NULL; dom_object *intern; - zend_error_handling error_handling; - zend_replace_error_handling(EH_THROW, dom_domexception_class_entry, &error_handling); - if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O", &id, dom_documentfragment_class_entry) == FAILURE) { - zend_restore_error_handling(&error_handling); + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "") == FAILURE) { return; } - zend_restore_error_handling(&error_handling); nodep = xmlNewDocFragment(NULL); if (!nodep) { |