Category
stdlib
Problem
DatePeriod is a core ext/date class for iterating date ranges (new DatePeriod($start, $interval, $end)). It is not registered — class_exists('DatePeriod') is false under bin/vm.php. Calendar/scheduling code and Symfony-style date utilities depend on it.
Follow-up to #3072 / #3162 (DateTime / DateInterval); DatePeriod requires both plus range iteration semantics.
php-src reference
Repro (failure today)
<?php
$start = new DateTime('2024-01-01');
$end = new DateTime('2024-01-04');
$step = new DateInterval('P1D');
foreach (new DatePeriod($start, $step, $end) as $dt) {
echo $dt->format('Y-m-d'), "\n";
}
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php repro.php'
# class DatePeriod not found (after #3072 DateTime exists)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php repro.php'
# Zend:
# 2024-01-01
# 2024-01-02
# 2024-01-03
Scope (this repo)
| Module |
Path |
| VM OOP |
ext/standard/VmDate.php or new ext/date/ module — DatePeriod + Iterator |
| Prerequisite |
#3072 DateTime, #3162 DateInterval |
| Foreach |
#3234 Traversable/Iterator foreach if object iteration not generic yet |
| Registration |
ext/standard/Module.php or dedicated date module |
| Tests |
test/compliance/cases/stdlib/date_period.phpt |
| Matrix |
docs/capabilities-syntax.md DateTime row extension |
Done when
Related
Category
stdlibProblem
DatePeriodis a core ext/date class for iterating date ranges (new DatePeriod($start, $interval, $end)). It is not registered —class_exists('DatePeriod')is false underbin/vm.php. Calendar/scheduling code and Symfony-style date utilities depend on it.Follow-up to #3072 / #3162 (DateTime / DateInterval); DatePeriod requires both plus range iteration semantics.
php-src reference
ext/date/php_date.c—php_date_initialize,DatePeriodclass registrationext/date/lib/period.c— period iteration / boundary rulesext/date/lib/timelib.h— timelib period helpersRepro (failure today)
Scope (this repo)
ext/standard/VmDate.phpor newext/date/module —DatePeriod+Iteratorext/standard/Module.phpor dedicated date moduletest/compliance/cases/stdlib/date_period.phptdocs/capabilities-syntax.mdDateTime row extensionDone when
DatePeriodimplementsIterator/Traversable;foreachworksnew DatePeriod($start, $interval, $recurrences)matches Zend./script/ci-fast.sh --filter date_periodgreenRelated
strtotime/mktime(orthogonal)