mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
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.
This commit is contained in:
parent
884b0365db
commit
122d759618
88 changed files with 426 additions and 642 deletions
|
@ -32,14 +32,13 @@ static inline RuleBasedBreakIterator *fetch_rbbi(BreakIterator_object *bio) {
|
|||
|
||||
static void _php_intlrbbi_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
|
||||
{
|
||||
zval *object = getThis();
|
||||
char *rules;
|
||||
size_t rules_len;
|
||||
zend_bool compiled = 0;
|
||||
UErrorCode status = U_ZERO_ERROR;
|
||||
intl_error_reset(NULL);
|
||||
|
||||
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|b",
|
||||
if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), "s|b",
|
||||
&rules, &rules_len, &compiled) == FAILURE) {
|
||||
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
|
||||
"rbbi_create_instance: bad arguments", 0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue