Category
stdlib
Problem
PHP 8.4 adds static factory methods DateTime::createFromTimestamp(int $timestamp): static and DateTimeImmutable::createFromTimestamp(int $timestamp): static. This compiler's VM DateTime builtins (#3072 phase 1) expose __construct, format, getTimestamp, setTimezone only — method_exists(DateTime::class, 'createFromTimestamp') is false.
php-src reference
Repro (PHP 8.4+ reference semantics)
<?php
$dt = DateTime::createFromTimestamp(1700000000);
echo $dt->getTimestamp(), "\n";
$di = DateTimeImmutable::createFromTimestamp(1700000000);
echo $di->getTimestamp(), "\n";
# Reference host PHP 8.4+:
php -r 'var_export(method_exists(DateTime::class,"createFromTimestamp"));'
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php -r "var_export(method_exists(\"DateTime\",\"createFromTimestamp\"));"'
| Check |
PHP 8.4+ Zend |
VM today |
method_exists(DateTime::class, 'createFromTimestamp') |
true |
false |
createFromTimestamp(1700000000)->getTimestamp() |
1700000000 |
fatal / missing method |
Harness Docker image is PHP 8.2 — gate PHPT with SKIPIF for PHP_VERSION_ID < 80400 until image bumps.
Scope (PHP-in-PHP)
| Path |
Work |
lib/VM/Builtin/DateTimeCreateFromTimestamp.php |
New VM handler |
lib/VM/BuiltinClasses.php |
Register static method on DateTime + DateTimeImmutable |
ext/date/ or ext/standard/ |
Shared timestamp→DateTime logic (reuse DateTimeSupport) |
| JIT/AOT |
Phase 1: requiresVmLowering OK; phase 2: LLVM like existing date builtins |
| Tests |
test/compliance/cases/stdlib/datetime_create_from_timestamp.phpt |
No new runtime/*.c — implement in PHP like #3072.
Done when
Related
Category
stdlibProblem
PHP 8.4 adds static factory methods
DateTime::createFromTimestamp(int $timestamp): staticandDateTimeImmutable::createFromTimestamp(int $timestamp): static. This compiler's VMDateTimebuiltins (#3072 phase 1) expose__construct,format,getTimestamp,setTimezoneonly —method_exists(DateTime::class, 'createFromTimestamp')is false.php-src reference
ext/date/php_date.c—PHP_METHOD(DateTime, createFromTimestamp)ext/date/php_datetime.stub.php— immutable twinRepro (PHP 8.4+ reference semantics)
method_exists(DateTime::class, 'createFromTimestamp')truefalsecreateFromTimestamp(1700000000)->getTimestamp()1700000000Harness Docker image is PHP 8.2 — gate PHPT with
SKIPIFforPHP_VERSION_ID < 80400until image bumps.Scope (PHP-in-PHP)
lib/VM/Builtin/DateTimeCreateFromTimestamp.phplib/VM/BuiltinClasses.phpext/date/orext/standard/DateTimeSupport)requiresVmLoweringOK; phase 2: LLVM like existing date builtinstest/compliance/cases/stdlib/datetime_create_from_timestamp.phptNo new
runtime/*.c— implement in PHP like #3072.Done when
DateTime::createFromTimestamp()+ immutable twin registered and callable on VM1700000000twice./script/ci-fast.sh --filter datetime_create_from_timestampgreen (with version skip)docs/capabilities-syntax.mdrow updated viascript/capability-syntax.phpRelated
createFromInterface) · Epic: Self-host critical path — compiler compiles itself (M3→M5) #1492