Skip to content

AOT: date_default_timezone_get() SIGSEGV; set() always false — DefaultTimezoneRuntime skips NestedJIT coerce (ext/date/php_date.c) #33950

Closed

Description

@PurHur

Category

bug · AOT crash / silent wrong · date_default_timezone_* NestedJIT ABI

Problem

On master @ da8da1d, thin AOT:

VM matches Zend. ./script/aot-smoke.sh is 8/8 — measuring the feature, not the linker.

Repro Zend 8.2+ AOT
echo date_default_timezone_get(); UTC SIGSEGV (139)
var_export(date_default_timezone_set('Europe/Berlin')); true false
set Berlin then date('T', 1721037600) CEST UTC bake / wrong

Root cause: DefaultTimezoneRuntime calls NestedJIT helpers with raw builder->call / writeString / zext($ok) — peers (IniRuntime, StringDateTime, TimezoneLocationRuntime) use JitNestedHelperCoerce::callHelper + extractStringPtrFromHelperResult / extractBoolFromHelperResult (#20664 / #8555 / #26773).

php-src reference

PHP implementation target

  • lib/JIT/Builtin/DefaultTimezoneRuntime.php — coerce NestedJIT string/bool ABI like IniRuntime
  • No new runtime/*.c

Repro

./script/aot-smoke.sh
./script/docker-exec.sh -- bash -lc 'printf "%s\n" "<?php echo date_default_timezone_get(), \"\\n\";" > /tmp/g.php; php /tmp/g.php; php bin/compile.php -o /tmp/g.bin /tmp/g.php && /tmp/g.bin; echo rc=$?'

Done when

  • AOT date_default_timezone_get() matches Zend (no SIGSEGV)
  • AOT date_default_timezone_set('Europe/Berlin') returns true; get returns Europe/Berlin
  • AOT date('T', 1721037600) after set Berlin → CEST
  • ./script/aot-smoke.sh stays 8/8
  • Targeted phpunit / AotTest guard

Activity

  1. added
    bugSomething isn't working
    phase-3:aotPhase 3 – AOT deployment
    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: worker-lane-B — starting this run (lane overflow: #32122/#31968/#33943/#33946 closed; AOT date_default_timezone_get SIGSEGV + set always false). aot-smoke 8/8.

  3. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-A — starting this run (AOT date_default_timezone_get SIGSEGV / set always false; lane A %3==0).

  4. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    claim: worker-lane-C — starting this run (lane C: 33950 % 3 == 2; prior A/B claims were overflow on our lane). aot-smoke 8/8; repro SIGSEGV confirmed on master @ 65aef52.

  5. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    Scope landed this run: AOT date_default_timezone_get() no longer SIGSEGVs; date_default_timezone_set('Europe/Berlin') returns true and get returns Europe/Berlin (invalid id → false, timezone unchanged).

    Root cause: (1) DefaultTimezoneRuntime raw NestedJIT call/writeString/zext without JitNestedHelperCoerce (#20664/#8555). (2) NestedJIT read of VmDate::$defaultTimezone / unbound VmDateTimeNative stubs under thin AOT — helper now owns the default-TZ static + zoneinfo is_file + durable copyTimezoneId.

    Follow-up (not this PR): free date('T'/'e'/…) after runtime date_default_timezone_set still uses the #33943 compile-time UTC bake — needs a runtime token helper (FormatDatetime still SIGSEGVs for T).

  6. PurHur commented on Aug 22, 2026

    @PurHur
    OwnerAuthor

    Merged #33953 (8a0f6e95eb)

    Verification

    • ./script/aot-smoke.sh → 8/8
    • ./script/phpunit.sh --filter 'Issue33950DefaultTimezoneAotTest|DefaultTimezoneRuntimeShrinkTest' → OK (6 tests, 44 assertions)
    • AOT repro stdout matches Zend: get UTC → set Berlin true → get Europe/Berlin → invalid false → get unchanged
    • #33943 date tz-token repro still matches under UTC default

    Follow-up: date('T') after runtime date_default_timezone_set still uses compile-time UTC bake (#33943); needs a runtime token helper (FormatDatetime still SIGSEGVs for T).

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-3:aotPhase 3 – AOT deployment

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions