Skip to content

AOT: DateTime{,Immutable}::add/sub with runtime DateInterval aborts compile (re-#30760, ext/date/php_date.c) #33781

Closed

Description

@PurHur

Category

bug · AOT compile abort · DateTime · stdlib · leftover of #30760

Problem

Thin user-script AOT threw when DateTime{,Immutable}::add/sub could not fold a compile-time DateInterval on the method arg (variable $i = new DateInterval('P1M')) and/or lacked the receiver's construct instant on the method $this Temporary. Year/month intervals need both stamps for VmDateTimeNative::applyIntervalState.

./script/aot-smoke.sh is 8/8.

Repro Zend / VM AOT (before)
$i=new DateInterval('P1M'); …->add($i) 2020-02-15 LogicException #30760

php-src reference

PHP implementation target

  • lib/JIT.php — applyDateMetaToDateTimeAddSubArgs restores interval stamp onto $interval ARG_SEND; DateTime instant note prefers $result after sync
  • ext/standard/JitDateMutation.php — honor compileTimeDateTimeTimestamp; recover instant from named bindings by layout; refresh stamps after mutable fold

Repro

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'php test/repro/issue_33781_datetime_runtime_interval_aot.php'
./script/docker-exec.sh -- bash -lc 'PHP_COMPILER_HELPER_RUNTIME_O=0 php bin/compile.php -o /tmp/di.bin test/repro/issue_33781_datetime_runtime_interval_aot.php && /tmp/di.bin'

Done when

  • AOT binary for variable DateInterval add/sub matches Zend/VM stdout
  • Year/month intervals (P1M) work, not only fixed-length
  • Targeted phpunit + aot-smoke stays 8/8
  • No new runtime/*.c

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/ext — AOT DateTime add/sub runtime DateInterval via existing DateMutationRuntime path (re-#30760 leftover).

  3. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: implementer-worker-lane-c — starting this run (lane overflow; #33781 is only open AOT crash, no PR on claim yet)

  4. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: implementer-worker-lane-b — starting this run (lane overflow; no open PR)

  5. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    merged in #33786

    verification:

    • ./script/aot-smoke.sh -> 8 passed, 0 failed
    • ./script/phpunit.sh --filter DateTimeAddSubAotTest -> OK (2 tests, 10 assertions)
    • ./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/di33781.bin test/repro/issue_33781_datetime_runtime_interval_aot.php && /tmp/di33781.bin' -> 2020-02-15 / 2020-01-16

    note: intervals whose compileTimeDateInterval is absent (fully dynamic spec) still hit runtime property-read LLVM; month component there SIGABRTs — follow-up if needed. Typical $i = new DateInterval('P1M') is covered via compileTimeDateInterval + JitGetdate civil path.

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