Skip to content

Regression: AOT DateTime::add/sub with DateInterval is a silent no-op for format/getTimestamp (re-#33781/#30760, ext/date/php_date.c) #33911

Closed

Description

@PurHur

Category

bug · AOT DateTime mutation / compile-time stamp staleness

Problem

After #33906 / #32691 stamp publishing, AOT DateTime::add/sub with a literal DateInterval updates the LLVM __dt_timestamp slot (or should) but leaves compileTimeDateTimeTimestamp / dateTimeLocalInstants on the receiver stale. DateTime::getTimestamp() and format() prefer the compile-time stamp, so the mutation is a silent no-op vs Zend.

Repro Zend 8.x AOT (master @ 91dc615)
$d=new DateTime('2020-01-15'); $d->add(new DateInterval('P1M')); echo $d->format('Y-m-d'); 2020-02-15 2020-01-15
same + getTimestamp() 1581724800 1579046400 (unchanged)
$d=new DateTime('2020-03-15'); $d->sub(new DateInterval('P1M')); 2020-02-15 2020-03-15

VM and JIT match Zend on the same tree. script/aot-smoke.sh is 8/8.

php-src reference

PHP implementation target

  • ext/standard/JitDateMutation.php — after mutable add/sub compile-time or LLVM apply, refresh or invalidate compileTimeDateTimeTimestamp + dateTimeLocalInstants so subsequent format/getTimestamp see the new instant (peer #33906 stamp publish)

Repro

./script/aot-smoke.sh   # must stay 8/8
./script/docker-exec.sh -- bash -lc 'php test/repro/issue_datetime_add_sub_p1m.php; php bin/compile.php -o /tmp/x.bin test/repro/issue_datetime_add_sub_p1m.php; /tmp/x.bin'

Done when

  • AOT matches Zend for add/sub + format/getTimestamp on P1M
  • Unit/repro guard under test/unit + test/repro
  • ./script/aot-smoke.sh still 8/8

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: implementer-worker-lane-c — starting this run (lane C: 33911%3==2; north-star #32122/#31968 closed; AOT DateTime::add/sub silent no-op vs Zend after stamp publish).

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