diff options
author | Derick Rethans <github@derickrethans.nl> | 2012-12-20 13:22:18 +0000 |
---|---|---|
committer | Derick Rethans <github@derickrethans.nl> | 2013-01-12 15:16:25 +0000 |
commit | 62129f31a758e86f62410262bb6096f1b2584363 (patch) | |
tree | b23e217baf4907eb765a00cb7afab4bb9fb92ed0 /ext/date/php_date.c | |
parent | 793b52b576e7af8823ae24622c6a331fd473e149 (diff) | |
download | php-git-immutable-date.tar.gz |
Make DatePeriod support DateTimeImmutable as well.immutable-date
If the start element is a DateTimeImmutable object, then all returned objects
are also DateTimeImmutable objects. If the start element is a DateTime object,
then all returned objects are DateTime objects.
Diffstat (limited to 'ext/date/php_date.c')
-rw-r--r-- | ext/date/php_date.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c index fc281ce086..cc83130e1c 100644 --- a/ext/date/php_date.c +++ b/ext/date/php_date.c @@ -1847,7 +1847,7 @@ static void date_period_it_current_data(zend_object_iterator *iter, zval ***data /* Create new object */ MAKE_STD_ZVAL(iterator->current); - php_date_instantiate(date_ce_date, iterator->current TSRMLS_CC); + php_date_instantiate(object->start_ce, iterator->current TSRMLS_CC); newdateobj = (php_date_obj *) zend_object_store_get_object(iterator->current TSRMLS_CC); newdateobj->time = timelib_time_ctor(); *newdateobj->time = *it_time; @@ -4182,6 +4182,7 @@ PHP_METHOD(DatePeriod, __construct) if (dpobj->end) { timelib_update_ts(dpobj->end, NULL); } + dpobj->start_ce = date_ce_date; } else { /* init */ intobj = (php_interval_obj *) zend_object_store_get_object(interval TSRMLS_CC); @@ -4197,6 +4198,7 @@ PHP_METHOD(DatePeriod, __construct) clone->tz_info = dateobj->time->tz_info; } dpobj->start = clone; + dpobj->start_ce = Z_OBJCE_P(start); /* interval */ dpobj->interval = timelib_rel_time_clone(intobj->diff); |