From 122d759618a42bff105971b923fbbb5be02e34b9 Mon Sep 17 00:00:00 2001 From: Nikita Popov Date: Thu, 2 Apr 2015 18:52:32 +0200 Subject: 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. --- ext/spl/spl_fixedarray.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'ext/spl/spl_fixedarray.c') diff --git a/ext/spl/spl_fixedarray.c b/ext/spl/spl_fixedarray.c index 9dbfa61344..48e9d2f85f 100644 --- a/ext/spl/spl_fixedarray.c +++ b/ext/spl/spl_fixedarray.c @@ -561,14 +561,7 @@ SPL_METHOD(SplFixedArray, __construct) spl_fixedarray_object *intern; zend_long size = 0; - int rv; - zend_error_handling zeh; - - zend_replace_error_handling(EH_THROW, spl_ce_InvalidArgumentException, &zeh TSRMLS_CC); - rv = zend_parse_parameters(ZEND_NUM_ARGS(), "|l", &size); - zend_restore_error_handling(&zeh TSRMLS_CC); - - if (rv == FAILURE) { + if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "|l", &size) == FAILURE) { return; } -- cgit v1.2.1