The artifact cited as the web-SAPI evidence could not have been run as it stood.
Measured in an official php:8.3-fpm container with the extension built in place:
- as shipped, no args: "SKIP: php-fpm not found", exit 0.
The default was `php-fpm8.3`, which matches neither the official images
(`php-fpm`) nor this repo's images.
- with the binary supplied by hand: 9 FAIL, every one with an empty `got:`.
The generated pool had no user/group, so php-fpm refused to start as root
("please specify user and group other than root"). A startup failure was
wearing the costume of nine parity bugs.
Changes:
- auto-detect the binary (php-fpm, php-fpm8.N, /usr/local/sbin, /usr/sbin) and
print which one was chosen plus its version;
- pre-flight the extension with `php-fpm -m`, so a .so that will not load into
THIS php-fpm reports as a harness failure naming the ABI mismatch rather
than as nine wrong paths;
- emit user/group in the pool when running as root, resolved from accounts
that actually exist (www-data / nobody / daemon), and chmod the fixture tmpdir
so the non-root worker can read it;
- run_case() now returns non-zero when php-fpm never answered, and every call
site routes that to die_startup(), which prints the php-fpm output and the
pool error_log and exits 2 — an exit code deliberately distinct from 1
(assertion failure).
After: 9/9 ALL PASS from a clean checkout with no arguments and no environment
fixing, running as root in php:8.3-fpm. Mutation-tested both new paths: a pool
user that does not exist reports "HARNESS FAILURE ... STARTUP/environment
failure" with the real php-fpm error and exit 2; an EXT_SO that is not a loadable
extension is caught by the pre-flight, also exit 2.
Also fixes doc drift: 001-rewrite.phpt pointed at tests/web-sapi-parity-check.sh,
which has never existed. The file it means is tests/fpm-parity-check.sh.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
26 lines
863 B
PHP
26 lines
863 B
PHP
--TEST--
|
|
cac_path_parity: rewrites the configured prefix on a filesystem $_SERVER key
|
|
--EXTENSIONS--
|
|
cac_path_parity
|
|
--INI--
|
|
cac_path_parity.from=/mnt/users/bob/site.com
|
|
cac_path_parity.to=/home/bob
|
|
variables_order=EGPCS
|
|
--ENV--
|
|
CONTEXT_DOCUMENT_ROOT=/mnt/users/bob/site.com/public_html
|
|
HTTP_HOST=site.com
|
|
--FILE--
|
|
<?php
|
|
// NOTE: the CLI SAPI overwrites DOCUMENT_ROOT (to "") and SCRIPT_FILENAME /
|
|
// PATH_TRANSLATED (to the script path) AFTER the env import, so those three
|
|
// cannot be driven from --ENV-- here. They go through the identical code path
|
|
// as CONTEXT_DOCUMENT_ROOT (one loop over one key table); the real web-SAPI
|
|
// proof for them is tests/fpm-parity-check.sh.
|
|
var_dump($_SERVER['CONTEXT_DOCUMENT_ROOT']);
|
|
// Non-path vars must be untouched.
|
|
var_dump($_SERVER['HTTP_HOST']);
|
|
?>
|
|
--EXPECT--
|
|
string(21) "/home/bob/public_html"
|
|
string(8) "site.com"
|