Skip to content

Regression: session_start() after output — ignores headers-sent guard (ext/session/session.c) #17707

Description

@PurHur

Category

Regression · php-src-strict

Problem

After any output has been sent (headers effectively started), Zend session_start() emits a warning, returns false, and leaves session_status() at PHP_SESSION_NONE (1). This compiler starts the session anyway (true, status 2).

Repro Zend 8.2+ VM (2026-07-10)
echo "x"; session_start(); return value false + Warning true (no warning)
session_status() after failed start 1 2

php-src reference

PHP implementation target

  • ext/standard/session_start.php — consult headers_sent() / VmSapiHeaderGuard before VmSession::start()
  • ext/standard/VmSession.php — shared guard for JIT/AOT via JitSessionStart / __phpc_session_start_apply

Repro

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

Done when

  • VM/JIT/AOT match Zend warning text, false return, and session_status()===PHP_SESSION_NONE
  • Compliance .phpt guard under test/compliance/cases/session/
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    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 10, 2026
  2. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #17708, #17707, #17709)

  3. PurHur commented on Jul 10, 2026

    @PurHur
    OwnerAuthor

    Merged in PR #17728 — VM repro + compliance guards green. See PR body for verification transcript.

  4. PurHur commented on Jul 15, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler Ext — I/O & Crypto — starting this run (session PHPT fixtures stale after #17707 headers-sent guard; 14 VMTest session failures on PHP_COMPILER_PROFILE=8.4).

  5. PurHur commented on Jul 15, 2026

    @PurHur
    OwnerAuthor

    Merged via PR #19226.

    Shipped:

    Verification:

    ./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && PHP_COMPILER_PROFILE=8.4 ./vendor/bin/phpunit test/compliance/VMTest.php --filter session'
    # OK (45 tests, 45 assertions)
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 machinebugSomething isn't workingenhancementNew 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