summaryrefslogtreecommitdiff
path: root/ext/intl/calendar/gregoriancalendar_methods.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ext/intl/calendar/gregoriancalendar_methods.cpp')
-rw-r--r--ext/intl/calendar/gregoriancalendar_methods.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/ext/intl/calendar/gregoriancalendar_methods.cpp b/ext/intl/calendar/gregoriancalendar_methods.cpp
index d9572a0668..d970cab595 100644
--- a/ext/intl/calendar/gregoriancalendar_methods.cpp
+++ b/ext/intl/calendar/gregoriancalendar_methods.cpp
@@ -38,7 +38,8 @@ static inline GregorianCalendar *fetch_greg(Calendar_object *co) {
return (GregorianCalendar*)co->ucal;
}
-static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
+static void _php_intlgregcal_constructor_body(
+ INTERNAL_FUNCTION_PARAMETERS, zend_bool is_constructor)
{
zval *tz_object = NULL;
zval args_a[6] = {0},
@@ -48,6 +49,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
zend_long largs[6];
UErrorCode status = U_ZERO_ERROR;
int variant;
+ int zpp_flags = is_constructor ? ZEND_PARSE_PARAMS_THROW : 0;
intl_error_reset(NULL);
// parameter number validation / variant determination
@@ -71,7 +73,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
// argument parsing
if (variant <= 2) {
- if (zend_parse_parameters(MIN(ZEND_NUM_ARGS(), 2),
+ if (zend_parse_parameters_ex(zpp_flags, MIN(ZEND_NUM_ARGS(), 2),
"|z!s!", &tz_object, &locale, &locale_len) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
"intlgregcal_create_instance: bad arguments", 0);
@@ -79,7 +81,7 @@ static void _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAMETERS)
return;
}
}
- if (variant > 2 && zend_parse_parameters(ZEND_NUM_ARGS(),
+ if (variant > 2 && zend_parse_parameters_ex(zpp_flags, ZEND_NUM_ARGS(),
"lll|lll", &largs[0], &largs[1], &largs[2], &largs[3], &largs[4],
&largs[5]) == FAILURE) {
intl_error_set(NULL, U_ILLEGAL_ARGUMENT_ERROR,
@@ -181,7 +183,7 @@ U_CFUNC PHP_FUNCTION(intlgregcal_create_instance)
object_init_ex(return_value, GregorianCalendar_ce_ptr);
ZVAL_COPY_VALUE(&orig, return_value);
- _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
zval_dtor(&orig);
@@ -195,8 +197,7 @@ U_CFUNC PHP_METHOD(IntlGregorianCalendar, __construct)
zend_replace_error_handling(EH_THROW, IntlException_ce_ptr, &error_handling);
return_value = getThis();
- //changes this to IS_NULL (without first destroying) if there's an error
- _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU);
+ _php_intlgregcal_constructor_body(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
if (Z_TYPE_P(return_value) == IS_OBJECT && Z_OBJ_P(return_value) == NULL) {
if (!EG(exception)) {
zend_throw_exception(IntlException_ce_ptr, "Constructor failed", 0);