summaryrefslogtreecommitdiff
path: root/ext/calendar/easter.c
diff options
context:
space:
mode:
Diffstat (limited to 'ext/calendar/easter.c')
-rw-r--r--ext/calendar/easter.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
index 7f26de0c00..05f54084b4 100644
--- a/ext/calendar/easter.c
+++ b/ext/calendar/easter.c
@@ -23,15 +23,20 @@
static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm)
{
-
/* based on code by Simon Kershaw, <webmaster@ely.anglican.org> */
struct tm te;
zend_long year, golden, solar, lunar, pfm, dom, tmp, easter, result;
zend_long method = CAL_EASTER_DEFAULT;
+ zend_bool year_is_null = 1;
+
+ if (zend_parse_parameters(ZEND_NUM_ARGS(),
+ "|l!l", &year, &year_is_null, &method) == FAILURE) {
+ RETURN_THROWS();
+ }
/* Default to the current year if year parameter is not given */
- {
+ if (year_is_null) {
time_t a;
struct tm b, *res;
time(&a);
@@ -43,11 +48,6 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, zend_long gm)
}
}
- if (zend_parse_parameters(ZEND_NUM_ARGS(),
- "|ll", &year, &method) == FAILURE) {
- RETURN_THROWS();
- }
-
if (gm && (year<1970 || year>2037)) { /* out of range for timestamps */
zend_argument_value_error(1, "must be between 1970 and 2037 (inclusive)");
RETURN_THROWS();