Skip to content

Stdlib: date_sun_info() — sun/twilight timestamp array missing (ext/date/php_date.c, pairs #6137) #6831

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

date_sun_info() returns an associative array of sunrise/sunset and twilight timestamps for a latitude/longitude. Distinct from scalar date_sunrise() / date_sunrise() tracked in #6137 — callers expect all keys in one call.

./script/docker-exec.sh -- bash -lc 'php -r "print_r(array_keys(date_sun_info(time(),48.8566,2.3522)));"'
# sunrise, sunset, transit, civil_twilight_begin, civil_twilight_end,
# nautical_twilight_begin, nautical_twilight_end,
# astronomical_twilight_begin, astronomical_twilight_end

./script/docker-exec.sh -- php bin/vm.php -r 'var_export(function_exists("date_sun_info"));'
# false

php-src reference

  • ext/date/php_date.c — PHP_FUNCTION(date_sun_info)
  • ext/date/lib/timelib.c — sun position / twilight calculations (same engine as date_sunrise)

Repro

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

Compare numeric timestamps per key against Zend within 1s tolerance.

Scope (this repo)

Area Path
Builtin ext/date/date_sun_info.php (new) or ext/standard/VmDate.php helper
VM Host bridge v1 acceptable (same as #6137 strategy)
Constants Share SUNFUNCS_RET_* with procedural sun functions
Tests test/compliance/cases/stdlib/date_sun_info_basic.phpt
Matrix script/capability-matrix.php

Done when

  • All nine array keys present and int timestamps match Zend for fixed lat/long/ts
  • Invalid latitude/longitude error paths match php-src
  • ./script/ci-fast.sh --filter date_sun_info green

Related

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 Jun 6, 2026
  2. PurHur commented on Jun 11, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib — starting this run

  3. PurHur commented on Jun 11, 2026

    @PurHur
    OwnerAuthor

    Merged via #7947.

    Verification

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
    php test/repro/maintainer_idate_date_sun_info.php
    php bin/vm.php test/repro/maintainer_idate_date_sun_info.php
    vendor/bin/phpunit --filter date_sun_info
    '

    PHPUnit: OK (5 tests, 9 assertions) — VM + JIT + AOT.

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 apps

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions