Skip to content

Stdlib: DatePeriod::getEndDate() missing — returns null for recurrence-count periods (ext/date/php_date.c) #17495

Description

@PurHur

Category

stdlib · date · php-src-strict

Problem

DatePeriod::getEndDate() is not registered. For a recurrence-count constructor, Zend returns null (no explicit end date). Callers using method_exists() or invoking the method fatally error on this compiler.

Repro Zend 8.2 VM (2026-07-09)
method_exists($period, 'getEndDate') true false
(new DatePeriod(..., 3))->getEndDate() null Call to undefined method DatePeriod::getEndDate()

php-src reference

PHP implementation target

  • ext/date/ + lib/VM/Builtin/DatePeriod*.php — expose instance method; return ?DateTimeInterface per period end mode (null when end is recurrence-limited)
  • Align with existing DatePeriod iterator/#14575 work in ext/date

Repro

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_dateperiod_get_end_date.php'

Done when

  • Repro prints ok on VM/JIT/AOT where DatePeriod is supported
  • End-date periods return the configured DateTimeInterface end
  • Compliance guard under test/compliance/cases/date/
  • php-src-strict

Activity

  1. added
    enhancementNew feature or request
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 9, 2026
  2. PurHur commented on Jul 9, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-c — starting this run

  3. PurHur commented on Jul 9, 2026

    @PurHur
    OwnerAuthor

    claim: cursor-agent-lane-a — starting this run

  4. PurHur commented on Jul 9, 2026

    @PurHur
    OwnerAuthor

    Merged via #17499

    Verification (Docker):

    • php bin/vm.php test/repro/maintainer_gap_dateperiod_get_end_date.php → ok
    • vendor/bin/phpunit test/compliance/VMTest.php --filter dateperiod_get_end_date → OK (1/1)
    • php script/bootstrap-inventory.php --check → OK 4293/4293
    • php script/check-selfhost-spine-coverage-sync.php → OK

    DatePeriod::getEndDate() now registered: null for recurrence-count periods, cloned end DateTimeInterface for end-date overload — matches Zend 8.2.

  5. PurHur commented on Jul 9, 2026

    @PurHur
    OwnerAuthor

    Merged via #17501

    Verification (VM/JIT):

    • `php bin/vm.php test/repro/maintainer_gap_dateperiod_get_end_date.php` → `ok`
    • `php bin/jit.php test/repro/maintainer_gap_dateperiod_get_end_date.php` → `ok`
    • `./script/phpunit.sh --filter dateperiod_get_end_date test/compliance/VMTest.php` → OK

    `DatePeriod::getEndDate()` registered; recurrence-count periods return `null`, end-date periods return cloned end `DateTimeInterface`.

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:vmVirtual machineenhancementNew feature or requestimplementation-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