Skip to content

php-in-php: CGI superglobal refresh — delete superglobals_refresh.c (~2623 lines), populate in lib/Web/ #5330

@PurHur

Description

@PurHur

Category

php-in-php | runtime

Problem

AOT/CGI binaries link lib/AOT/runtime/superglobals_refresh.c (~2623 lines) to repopulate $_GET, $_POST, $_SERVER, $_ENV, $_COOKIE, $_FILES, and $_REQUEST from environment variables and stdin. The same logic belongs in lib/Web/ + compiled PHP (or thin ABI calling PHP helpers), not a hand-written C parser duplicating multipart/CGI rules.

php-src reference

Repro (C runtime today)

./script/docker-exec.sh -- bash -lc 'wc -l lib/AOT/runtime/superglobals_refresh.c
grep superglobals_refresh lib/AOT/Linker.php
'

Web north-star regressions surface via existing gates when refresh semantics drift:

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
vendor/bin/phpunit test/unit/Web/CgiDriverTest.php --filter multipart
'

Scope (this repo)

Area Files
PHP implementation lib/Web/SuperglobalRefresh.php (or extend existing web runtime)
VM/CGI entry bin/cgi.php, lib/Web/CgiDriver.php
Delete lib/AOT/runtime/superglobals_refresh.c
Linker lib/AOT/Linker.php — drop C TU; native bridge calls PHP refresh
Tests CgiDriverTest, examples/006-FileUploadWeb multipart smoke

Default: port behavior into PHP this repo owns; keep C as thin getenv/trampoline only if unavoidable.

Done when

  • superglobals_refresh.c removed from link set
  • PR notes ~2623 lines removed from runtime/
  • CGI multipart + nested $_FILES smoke green (no PHP_COMPILER_SKIP_SERVE_TESTS)
  • $_REQUEST merge order matches Zend (GET+POST+COOKIE)

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:compilerCompiler / CFG / JITarea:vmVirtual machineenhancementNew feature or requestimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-0:FoundationPhase 0 – foundation & DevExphase-1:web-runtimePhase 1 – CGI/web runtime

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions