. Fixed bug #77742 (bcpow() implementation related to gcc compiler
optimization). (Nikita)
-- FPM:
- . Fixed bug #77677 (FPM fails to build on AIX due to missing WCOREDUMP).
- (Kevin Adler)
-
- Date:
. Fixed bug #50020 (DateInterval:createDateFromString() silently fails).
(Derick)
+ . Fixed bug #75113 (Added DatePeriod::getRecurrences() method). (Ignace
+ Nyamagana Butera)
+
+- FPM:
+ . Fixed bug #77677 (FPM fails to build on AIX due to missing WCOREDUMP).
+ (Kevin Adler)
- GD:
. Fixed bug #77700 (Writing truecolor images as GIF ignores interlace flag).
PHP_ME(DatePeriod, getStartDate, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DatePeriod, getEndDate, NULL, ZEND_ACC_PUBLIC)
PHP_ME(DatePeriod, getDateInterval, NULL, ZEND_ACC_PUBLIC)
+ PHP_ME(DatePeriod, getRecurrences, NULL, ZEND_ACC_PUBLIC)
PHP_FE_END
};
}
/* }}} */
+/* {{{ proto int DatePeriod::getRecurrences()
+ Get recurrences.
+*/
+PHP_METHOD(DatePeriod, getRecurrences)
+{
+ php_period_obj *dpobj;
+ php_date_obj *dateobj;
+
+ if (zend_parse_parameters_none() == FAILURE) {
+ return;
+ }
+
+ dpobj = Z_PHPPERIOD_P(ZEND_THIS);
+
+ if (0 == dpobj->recurrences - dpobj->include_start_date) {
+ return;
+ }
+
+ RETURN_LONG(dpobj->recurrences - dpobj->include_start_date);
+}
+/* }}} */
+
static int check_id_allowed(char *id, zend_long what) /* {{{ */
{
if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
PHP_METHOD(DatePeriod, getStartDate);
PHP_METHOD(DatePeriod, getEndDate);
PHP_METHOD(DatePeriod, getDateInterval);
+PHP_METHOD(DatePeriod, getRecurrences);
/* Options and Configuration */
PHP_FUNCTION(date_default_timezone_set);
$end = new DateTime('2000-01-31 00:00:00', new DateTimeZone('UTC'));
$interval = new DateInterval('P1D');
$period = new DatePeriod($start, $interval, $end);
+$recurrences = 4;
var_dump($period->getStartDate()->format('Y-m-d H:i:s'));
var_dump($period->getStartDate()->getTimeZone()->getName());
var_dump($period->getEndDate()->getTimeZone()->getName());
var_dump($period->getDateInterval()->format('%R%y-%m-%d-%h-%i-%s'));
+var_dump($period->getRecurrences());
+
+$periodWithRecurrences = new DatePeriod($start, $interval, $recurrences);
+
+var_dump($periodWithRecurrences->getRecurrences());
+var_dump($periodWithRecurrences->getEndDate());
+
+$periodWithRecurrencesWithoutStart = new DatePeriod($start, $interval, $recurrences, DatePeriod::EXCLUDE_START_DATE);
+
+var_dump($periodWithRecurrences->getRecurrences());
+
?>
--EXPECTF--
string(19) "2000-01-01 00:00:00"
string(19) "2000-01-31 00:00:00"
string(3) "UTC"
string(12) "+0-0-1-0-0-0"
+NULL
+int(4)
+NULL
+int(4)