summaryrefslogtreecommitdiff
path: root/ext/intl/timezone/timezone_methods.cpp
diff options
context:
space:
mode:
authorMáté Kocsis <kocsismate@woohoolabs.com>2019-10-29 15:45:46 +0100
committerNikita Popov <nikita.ppv@gmail.com>2019-10-30 13:21:40 +0100
commit969e7a3c8b7ee3cc51502f1ff1e751ad71fd049c (patch)
treed66acb5c6bc0aa0932085f22f7bdc76d59c151c8 /ext/intl/timezone/timezone_methods.cpp
parent5cbe5a538c92d7d515b0270625e2f705a1c02b18 (diff)
downloadphp-git-969e7a3c8b7ee3cc51502f1ff1e751ad71fd049c.tar.gz
Cleanup return values for Intl when parameter parsing is unsuccessful
Closes GH-4871.
Diffstat (limited to 'ext/intl/timezone/timezone_methods.cpp')
-rw-r--r--ext/intl/timezone/timezone_methods.cpp50
1 files changed, 26 insertions, 24 deletions
diff --git a/ext/intl/timezone/timezone_methods.cpp b/ext/intl/timezone/timezone_methods.cpp
index f32c5756bf..518d63c94a 100644
--- a/ext/intl/timezone/timezone_methods.cpp
+++ b/ext/intl/timezone/timezone_methods.cpp
@@ -53,7 +53,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone)
intl_error_reset(NULL);
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s", &str_id, &str_id_len) == FAILURE) {
- RETURN_NULL();
+ return;
}
UErrorCode status = UErrorCode();
@@ -78,7 +78,7 @@ U_CFUNC PHP_FUNCTION(intltz_from_date_time_zone)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "O",
&zv_timezone, php_date_get_timezone_ce()) == FAILURE) {
- RETURN_NULL();
+ return;
}
tzobj = Z_PHPTIMEZONE_P(zv_timezone);
@@ -103,7 +103,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_default)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_NULL();
+ return;
}
TimeZone *tz = TimeZone::createDefault();
@@ -115,7 +115,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_gmt)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_NULL();
+ return;
}
timezone_object_construct(TimeZone::getGMT(), return_value, 0);
@@ -126,7 +126,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_unknown)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_NULL();
+ return;
}
timezone_object_construct(&TimeZone::getUnknown(), return_value, 0);
@@ -141,7 +141,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_enumeration)
/* double indirection to have the zend engine destroy the new zval that
* results from separation */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "|z", &arg) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (arg == NULL || Z_TYPE_P(arg) == IS_NULL) {
@@ -201,7 +201,7 @@ U_CFUNC PHP_FUNCTION(intltz_count_equivalent_ids)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&str_id, &str_id_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
UErrorCode status = UErrorCode();
@@ -230,7 +230,7 @@ U_CFUNC PHP_FUNCTION(intltz_create_time_zone_id_enumeration)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "l|s!l!",
&zoneType, &region, &region_len, &offset_arg, &arg3isnull) == FAILURE) {
- RETURN_FALSE;
+ return;
}
if (zoneType != UCAL_ZONE_TYPE_ANY && zoneType != UCAL_ZONE_TYPE_CANONICAL
@@ -269,7 +269,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_canonical_id)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|z",
&str_id, &str_id_len, &is_systemid) == FAILURE) {
- RETURN_FALSE;
+ return;
}
UErrorCode status = UErrorCode();
@@ -306,7 +306,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_region)
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s",
&str_id, &str_id_len) == FAILURE) {
- RETURN_FALSE;
+ return;
}
UErrorCode status = UErrorCode();
@@ -328,7 +328,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_tz_data_version)
intl_error_reset(NULL);
if (zend_parse_parameters_none() == FAILURE) {
- RETURN_FALSE;
+ return;
}
UErrorCode status = UErrorCode();
@@ -346,9 +346,11 @@ U_CFUNC PHP_FUNCTION(intltz_get_equivalent_id)
zend_long index;
intl_error_reset(NULL);
- if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl",
- &str_id, &str_id_len, &index) == FAILURE ||
- index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS(), "sl", &str_id, &str_id_len, &index) == FAILURE) {
+ return;
+ }
+
+ if (index < (zend_long)INT32_MIN || index > (zend_long)INT32_MAX) {
RETURN_FALSE;
}
@@ -375,7 +377,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_id)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- RETURN_FALSE;
+ return;
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -398,7 +400,7 @@ U_CFUNC PHP_FUNCTION(intltz_use_daylight_time)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- RETURN_FALSE;
+ return;
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -419,7 +421,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_offset)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"Odbz/z/", &object, TimeZone_ce_ptr, &date, &local, &rawOffsetArg,
&dstOffsetArg) == FAILURE) {
- RETURN_FALSE;
+ return;
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -443,7 +445,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_raw_offset)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- RETURN_FALSE;
+ return;
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -460,7 +462,7 @@ U_CFUNC PHP_FUNCTION(intltz_has_same_rules)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"OO", &object, TimeZone_ce_ptr, &other_object, TimeZone_ce_ptr)
== FAILURE) {
- RETURN_FALSE;
+ return;
}
TIMEZONE_METHOD_FETCH_OBJECT;
other_to = Z_INTL_TIMEZONE_P(other_object);
@@ -491,7 +493,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_display_name)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O|bls!", &object, TimeZone_ce_ptr, &daylight, &display_type,
&locale_str, &dummy) == FAILURE) {
- RETURN_FALSE;
+ return;
}
bool found = false;
@@ -528,7 +530,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_dst_savings)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- RETURN_FALSE;
+ return;
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -543,7 +545,7 @@ U_CFUNC PHP_FUNCTION(intltz_to_date_time_zone)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(),
"O", &object, TimeZone_ce_ptr) == FAILURE) {
- RETURN_FALSE;
+ return;
}
TIMEZONE_METHOD_FETCH_OBJECT;
@@ -564,7 +566,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_code)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- RETURN_FALSE;
+ return;
}
/* Fetch the object (without resetting its last error code ). */
@@ -582,7 +584,7 @@ U_CFUNC PHP_FUNCTION(intltz_get_error_message)
if (zend_parse_method_parameters(ZEND_NUM_ARGS(), getThis(), "O",
&object, TimeZone_ce_ptr) == FAILURE) {
- RETURN_FALSE;
+ return;
}