API Index — Namespaces, Packages, Reports, Indices
cgi_worker.php
Table of Contents
Functions
- __z_fire_header_callback() : void
- #357 — fire a registered header_register_callback() exactly once (mod_php keeps a single callback). Two registration sources, drained in order: (1) the subprocess-local override above, which stashes into $GLOBALS['__z_header_callback'] (the common case — autoload off); (2) the framework's utils.php header_register_callback(), active when ZEALPHP_CGI_AUTOLOAD=1, which stashes into the RequestContext memo.
- __z_send_meta() : mixed
- Write the metadata frame (status, headers, cookies, optional return value) to
STDERRas a single JSON line. Idempotent — subsequent calls are no-ops once$__z_meta_sentistrue. Called by theflush()override and the shutdown function so the frame is always sent before the body, regardless of whether the included file streams or buffers. - apache_request_headers() : array<string, string>
- Polyfill for
apache_request_headers()in CLI SAPI. - getallheaders() : array<string, string>
- Polyfill for
getallheaders()in CLI SAPI — delegates toapache_request_headers(). - apache_response_headers() : array<string, string>
- Polyfill for
apache_response_headers()in CLI SAPI. - apache_setenv() : bool
- Polyfill for
apache_setenv()in CLI SAPI. - apache_getenv() : mixed
- Polyfill for
apache_getenv()in CLI SAPI. - apache_note() : string
- Polyfill for
apache_note()in CLI SAPI. - virtual() : bool
- Polyfill for
virtual()in CLI SAPI.
Functions
__z_fire_header_callback()
#357 — fire a registered header_register_callback() exactly once (mod_php keeps a single callback). Two registration sources, drained in order: (1) the subprocess-local override above, which stashes into $GLOBALS['__z_header_callback'] (the common case — autoload off); (2) the framework's utils.php header_register_callback(), active when ZEALPHP_CGI_AUTOLOAD=1, which stashes into the RequestContext memo.
__z_fire_header_callback() : void
MUST be called while the header() override is still active (right after the included file finishes) — NOT from the shutdown function: uopz tears its overrides down before register_shutdown_function runs, so header() calls inside a callback fired at shutdown would not be captured into $__z_headers.
__z_send_meta()
Write the metadata frame (status, headers, cookies, optional return value) to STDERR
as a single JSON line. Idempotent — subsequent calls are no-ops once $__z_meta_sent
is true. Called by the flush() override and the shutdown function so the frame is
always sent before the body, regardless of whether the included file streams or buffers.
__z_send_meta() : mixed
apache_request_headers()
Polyfill for apache_request_headers() in CLI SAPI.
apache_request_headers() : array<string, string>
Reconstructs the canonical header map from $_SERVER HTTP_* keys plus
CONTENT_TYPE and CONTENT_LENGTH, matching Apache mod_php behaviour.
Return values
array<string, string> —Map of header name → value.
getallheaders()
Polyfill for getallheaders() in CLI SAPI — delegates to apache_request_headers().
getallheaders() : array<string, string>
Return values
array<string, string> —Map of header name → value.
apache_response_headers()
Polyfill for apache_response_headers() in CLI SAPI.
apache_response_headers() : array<string, string>
Returns the response headers collected so far by the header() override.
Return values
array<string, string> —Map of header name → value.
apache_setenv()
Polyfill for apache_setenv() in CLI SAPI.
apache_setenv(string $variable, string $value[, bool $walk_to_top = false ]) : bool
Stores $value in the subprocess-local $__z_apache_env map (Apache mod_env parity).
Parameters
- $variable : string
- $value : string
- $walk_to_top : bool = false
Return values
boolapache_getenv()
Polyfill for apache_getenv() in CLI SAPI.
apache_getenv(string $variable[, bool $walk_to_top = false ]) : mixed
Reads from $__z_apache_env; returns false when the variable is not set.
Parameters
- $variable : string
- $walk_to_top : bool = false
apache_note()
Polyfill for apache_note() in CLI SAPI.
apache_note(string $note_name[, string|null $note_value = null ]) : string
Gets/sets a named note in $__z_apache_notes. Returns the previous value (empty string if unset).
Parameters
- $note_name : string
- $note_value : string|null = null
Return values
stringvirtual()
Polyfill for virtual() in CLI SAPI.
virtual(string $uri) : bool
Internal sub-requests are not supported in the subprocess context — always returns false.
Parameters
- $uri : string