Category
stdlib
Problem
#3072 landed VM DateTime + DateTimeZone via lib/VM/DateTimeSupport.php (host PHP date extension for parse/format). Zend also provides DateTimeImmutable, DateInterval, and DateTime::diff() — common in logging, sessions, and immutable config snapshots.
PHP 8.4 follow-ups (separate issues but same ext/date surface): DateTime::createFromTimestamp() (#5973), createFromInterface() (#5936).
php-src reference
Repro A — immutable + modify (failure today)
<?php
$immutable = new DateTimeImmutable('2026-05-29 12:00:00', new DateTimeZone('UTC'));
$modified = $immutable->modify('+1 day');
echo $modified->format('Y-m-d'), "\n";
var_export($immutable === $modified);
echo "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php repro_datetime_immutable.php
php bin/vm.php repro_datetime_immutable.php
'
| Runtime |
format |
$immutable === $modified |
| Zend |
2026-05-30 |
false (new instance) |
| VM today |
compile/runtime error — DateTimeImmutable unknown |
— |
Repro B — DateInterval via diff()
<?php
$dt = new DateTime('2026-05-29');
$interval = $dt->diff(new DateTime('2026-06-05'));
echo $interval->days, "\n";
echo $interval->invert ? 'inverted' : 'forward', "\n";
Zend: 6 and forward.
VM today: DateInterval class missing.
Repro C — procedural date_diff() (optional v1)
<?php
$di = date_diff(new DateTime('2026-01-01'), new DateTime('2026-01-08'));
echo $di->days, "\n";
Track in same PHPT or defer to #4604.
Scope (this repo)
| Layer |
Path |
Notes |
| VM classes |
Extend lib/VM/DateTimeSupport.php |
DateTimeImmutable shares storage; modify returns new instance |
| VM classes |
DateInterval object with days, invert, format() |
|
| Methods v1 |
__construct, format, modify, getTimestamp, getTimezone, diff |
Defer createFromTimestamp to #5973 |
| Registration |
lib/VM/BuiltinClasses.php or date module loader |
Mirror DateTime phase-1 pattern |
| JIT/AOT |
VM defer v1 (same as #3072) |
Document in matrix; JIT issue if method dispatch blocked |
| Tests |
test/compliance/cases/stdlib/datetime_immutable.phpt, datetime_diff.phpt |
|
| Matrix |
script/capability-matrix.php |
|
PHP-in-PHP note: long-term replace host \DateTime delegation with native parsing in ext/date/ — out of scope here; keep host bridge for v1.
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter datetime_immutable'
Dependencies
Links
Category
stdlibProblem
#3072 landed VM
DateTime+DateTimeZonevialib/VM/DateTimeSupport.php(host PHPdateextension for parse/format). Zend also providesDateTimeImmutable,DateInterval, andDateTime::diff()— common in logging, sessions, and immutable config snapshots.PHP 8.4 follow-ups (separate issues but same ext/date surface):
DateTime::createFromTimestamp()(#5973),createFromInterface()(#5936).php-src reference
ext/date/php_datetime.c—DateTimeImmutable,DateInterval,DateTime::diffext/date/php_datetime.stub.php— method signaturesext/date/php_date.c— proceduraldate_diff()Repro A — immutable + modify (failure today)
format$immutable === $modified2026-05-30false(new instance)DateTimeImmutableunknownRepro B — DateInterval via diff()
Zend:
6andforward.VM today:
DateIntervalclass missing.Repro C — procedural date_diff() (optional v1)
Track in same PHPT or defer to #4604.
Scope (this repo)
lib/VM/DateTimeSupport.phpDateTimeImmutableshares storage;modifyreturns new instanceDateIntervalobject withdays,invert,format()__construct,format,modify,getTimestamp,getTimezone,diffcreateFromTimestampto #5973lib/VM/BuiltinClasses.phpor date module loaderDateTimephase-1 patterntest/compliance/cases/stdlib/datetime_immutable.phpt,datetime_diff.phptscript/capability-matrix.phpPHP-in-PHP note: long-term replace host
\DateTimedelegation with native parsing inext/date/— out of scope here; keep host bridge for v1.Done when
2026-05-30andfalseon VM6andforwardon VMclass_exists('DateTimeImmutable')andclass_exists('DateInterval')true./script/ci-fast.sh --filter datetime_immutablegreendocs/capabilities-syntax.md/ matrix updated (Immutable + Interval rows)Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter datetime_immutable'Dependencies
dateextension in Docker image (same as phase 1)Links