Skip to content

AOT: DatePeriod foreach SIGABRTs — snapshot still reads compileTimeLong after DateTime timestamp field split (re-#26937, ext/date/php_date.c) #33744

Description

@PurHur

Category

bug · AOT / DatePeriod · php-src-strict

Problem

Thin AOT foreach (new DatePeriod(...)) compiles then SIGABRTs (rc=134). Zend prints the dates. This is a regression of #26772 / #26937: JitDateTimeConstruct stamps compileTimeDateTimeTimestamp (#32691) so DateTime is not treated as an int, but JitDatePeriodConstruct still reads compileTimeLong, so the foreach snapshot is empty. VmIteratorForeach::compileReset then takes object-property foreach before the DatePeriod snapshot, and format() on a property value aborts.

./script/aot-smoke.sh is 8/8. Probed 2026-08-22.

Repro Zend 8.2 AOT (master)
foreach (new DatePeriod(new DateTimeImmutable('2020-01-01'), new DateInterval('P1D'), new DateTimeImmutable('2020-01-05')) as $d) echo $d->format('Y-m-d') 2020-01-01,2020-01-02,2020-01-03,2020-01-04 rc=134 SIGABRT
recurrences form new DatePeriod(..., 2) 2020-01-01 2020-01-02 2020-01-03 rc=134

php-src reference

PHP implementation target

Repro

./script/docker-exec.sh -- bash -lc 'php bin/compile.php -o /tmp/dp test/repro/maintainer_gap_aot_dateperiod_foreach.php && /tmp/dp'

Done when

  • AOT foreach over compile-time DatePeriod (end-date + recurrences) matches Zend
  • ./script/aot-smoke.sh stays 8/8

Activity

  1. added
    bugSomething isn't working
    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 overflow: #32122 and #31968 children closed; DatePeriod foreach AOT SIGABRT re-#26937)

  3. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    merged: #33747 (36aff1ea8b)

    Fix: DatePeriod foreach snapshot reads compileTimeDateTimeTimestamp (not compileTimeLong); snapshot RESET runs before object-property foreach; DateTime construct sync no longer clobbers other DateTimeImmutable locals.

    Verification

    • ./script/docker-exec.sh -- bash -lc './script/aot-smoke.sh' → 8/8
    • ./script/phpunit.sh --filter Issue33744DatePeriodForeachAotTest → OK (5 tests)
    • AOT test/repro/issue_33744_dateperiod_foreach_aot.php matches Zend (end-date + recurrences + inline ctor)
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-2:languagePhase 2 – language features

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions