summaryrefslogtreecommitdiff
path: root/ext/calendar
diff options
context:
space:
mode:
authorMarkus Fischer <mfischer@php.net>2002-06-10 07:51:28 +0000
committerMarkus Fischer <mfischer@php.net>2002-06-10 07:51:28 +0000
commit3856c3ff398e781d6296a0519f6e88b17782327f (patch)
treeb4e482665ad9667ea44c5bd6f715fe3cd35d8986 /ext/calendar
parent7f4c12b0061305d54f7c200fe3b4d76c193655ad (diff)
downloadphp-git-3856c3ff398e781d6296a0519f6e88b17782327f.tar.gz
- Fix easter_(days|date)()s first parameter now really defaults to the current
year if ommited (it was document but didn't work).
Diffstat (limited to 'ext/calendar')
-rw-r--r--ext/calendar/easter.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/ext/calendar/easter.c b/ext/calendar/easter.c
index 10d8ae401e..d3f5c57480 100644
--- a/ext/calendar/easter.c
+++ b/ext/calendar/easter.c
@@ -33,8 +33,17 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
long year, golden, solar, lunar, pfm, dom, tmp, easter;
long method = CAL_EASTER_DEFAULT;
+ /* Default to the current year if year parameter is not given */
+ {
+ time_t a;
+ struct tm b;
+ time(&a);
+ php_localtime_r(&a, &b);
+ year = 1900 + b.tm_year;
+ }
+
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC,
- "l|l", &year, &method) == FAILURE) {
+ "|ll", &year, &method) == FAILURE) {
return;
}
@@ -116,7 +125,7 @@ PHP_FUNCTION(easter_date)
}
/* }}} */
-/* {{{ proto int easter_days([int year])
+/* {{{ proto int easter_days([int year, [int method]])
Return the number of days after March 21 that Easter falls on for a given year (defaults to current year) */
PHP_FUNCTION(easter_days)
{