Skip to content

Regression: AOT DateTime::diff() fails after two locals — New_ resultOp unnamed so construct stamps never bind (re-#27309) #33906

Closed

Description

@PurHur

Category

bug · php-src-strict · AOT / ext/date (re-#27309)

Problem

After #32691 moved DateTime construct stamps onto compileTimeDateTimeTimestamp, thin AOT again fails the #27309 fixture whenever two DateTime locals are constructed before diff:

$a = new DateTime('2024-01-01');
$b = new DateTime('2024-01-10');
echo $a->diff($b)->days;
Repro Zend / VM / JIT AOT (master before fix)
above 9 DateTime::diff() requires compile-time DateTime receivers (#27309)

Root cause: syncDateTimeConstructMetaToAliases only published dateTimeLocalInstants when lastDateTimeNewResultOp had an Operand name. Temporary New_ results are often unnamed, and named bindings for $a/$b are different Variable objects than the construct $this, so identity matching never recorded the local. $a->diff($b) then saw a receiver with no stamp (str='DateTime' only).

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./phpc build -o /tmp/d.bin test/repro/issue_33910_datetime_diff_two_locals_aot.php && /tmp/d.bin'

Done when

  • AOT prints 9 for the two-local repro
  • vendor/bin/phpunit --filter datetime_diff_days test/aot/AotTest.php OK
  • DatePeriod foreach two-bound construct still matches Zend (2020-01-01|…)

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Aug 22, 2026
  2. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: advanced-stdlib — implementing fix (sync unnamed New_ DateTime stamps + compileTimeDateTimeTimestamp in resolveCompileTimeInstant).

  3. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: implementer-worker-lane-a — starting this run (lane A: 33906%3==0; north-star #32122/#31968 closed; prior advanced-stdlib claim has no branch/PR — taking to land AOT DateTime::diff two-local stamps).

  4. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: stdlib-aot-specialist — resuming (prior claims have no branch/PR after several minutes; this is the only open AOT/stdlib crash; landing sync for unnamed New_ + compileTimeDateTimeTimestamp in resolveCompileTimeInstant).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITbugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions