Category
stdlib | php-src-strict | PHP 8.4
Problem
PHP 8.4 adds DatePeriod::createFromISO8601(string $spec): DatePeriod — a static factory parsing ISO8601 recurring intervals (e.g. 2024-01-01T00:00:00/2024-01-03T00:00:00/P1D).
This compiler has no DatePeriod class (#3633) and therefore no factory. Scheduling utilities and Symfony-style date code expect the method once base OOP lands.
php-src reference
Dependency graph
| Prerequisite |
Issue |
DatePeriod OOP + iteration |
#3633 (or fold into this issue if unclaimed) |
DateInterval parsing |
#3162 |
| Invalid spec exceptions |
#7129 (DateMalformedPeriodException) |
Claim strategy: If #3633 is open, implement DatePeriod + factory together; otherwise implement factory stub that fatals until class exists.
Repro (failure today)
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(method_exists(DatePeriod::class, \"createFromISO8601\")); echo PHP_EOL;"
'
# bool(false) — class missing
Minimal script once DatePeriod exists:
<?php
$p = DatePeriod::createFromISO8601('2024-01-01T00:00:00/2024-01-03T00:00:00/P1D');
foreach ($p as $d) { echo $d->format('Y-m-d'), "\n"; break; }
Expected: prints 2024-01-01
Invalid spec (pairs #7129):
DatePeriod::createFromISO8601('not-an-interval');
// DateMalformedPeriodException
Scope (PHP-in-PHP)
Done when
- Valid repro prints first period date
2024-01-01
- Malformed spec throws
DateMalformedPeriodException (not generic Exception)
- Compliance
.phpt under test/compliance/cases/stdlib/date_period_create_from_iso8601.phpt
- Capability matrix regenerated (
script/capability-matrix.php)
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php vendor/bin/phpunit --filter date_period_create_from_iso8601
'
Labels
stdlib · implementation-ready · blocks web/calendar examples using ISO8601 periods
Category
stdlib| php-src-strict | PHP 8.4Problem
PHP 8.4 adds
DatePeriod::createFromISO8601(string $spec): DatePeriod— a static factory parsing ISO8601 recurring intervals (e.g.2024-01-01T00:00:00/2024-01-03T00:00:00/P1D).This compiler has no
DatePeriodclass (#3633) and therefore no factory. Scheduling utilities and Symfony-style date code expect the method once base OOP lands.php-src reference
ext/date/php_date.c—php_date_period_create_from_iso8601ext/date/php_date.stub.php—DatePeriod::createFromISO8601ext/date/tests/date_period_create_from_iso8601.phptDependency graph
DatePeriodOOP + iterationDateIntervalparsingDateMalformedPeriodException)Claim strategy: If #3633 is open, implement
DatePeriod+ factory together; otherwise implement factory stub that fatals until class exists.Repro (failure today)
Minimal script once
DatePeriodexists:Expected: prints
2024-01-01Invalid spec (pairs #7129):
Scope (PHP-in-PHP)
ext/date/— registerDatePeriodstatic method handler (coordinate Stdlib: DatePeriod OOP — date range iteration (ext/date/php_date.c parity) #3633)VmDate/ date helpers in PHPruntime/*.cDone when
2024-01-01DateMalformedPeriodException(not genericException).phptundertest/compliance/cases/stdlib/date_period_create_from_iso8601.phptscript/capability-matrix.php)Verification
Labels
stdlib·implementation-ready· blocks web/calendar examples using ISO8601 periods