symfony/process
Symfony Process executes commands in sub-processes, giving PHP apps a clean, portable API for running external programs. It handles input/output streams, timeouts, environment variables, working directories, and exit codes, so you can run shell commands safely and reliably across platforms.
RunProcessMessage) or Console Components, reducing friction for teams already using Symfony packages.v8.1.0-BETA2 (feature branch). This release, v5.4.54, is a maintenance + security patch on the 5.4 LTS line — no new APIs, no architectural change. Architecture-fit conclusions from the prior assessment stand unchanged; what changes is the risk and patching posture below.exec(), shell_exec(), or proc_open() calls with a fluent API:
$process = new Process(['ls', '-la']);
$process->run();
echo $process->getOutput();
--build-arg) or Kubernetes. Behavior change in 5.4.54: invalid env var names and non-scalar env values are now ignored rather than propagated — sanitization that is correct but silent, so misconfigured env payloads will no longer fail loudly at the boundary.stdout/stderr enable progress tracking or logging without buffering entire outputs.ProcessFailedException) with exit codes and timeout management simplify debugging.5.4.51 → 5.4.54). No signature changes to Process, no deprecations. Expected integration effort is composer update + regression run, not code changes — unless the app depends on request-context env inheritance (see risk below).v5.4.54 is tagged a security release. Three fixes:
#65738 Stop leaking CGI/FastCGI request-context vars to subprocesses — highest relevance for Laravel. Any app running under PHP-FPM/CGI that shells out previously could inherit request-scoped environment variables into child processes, exposing request context (headers, paths, potentially auth-adjacent values) to external tools, logs, or third-party binaries. Directly mitigates a data-exposure path in shared-process environments.#65739 Ignore invalid env var names and non-scalar env values — defense-in-depth hardening of the env-injection surface. Behavioral: silently drops bad entries (see above).#65784 Use an absolute path for the cmd.exe fallback on Windows — closes a binary-hijacking / PATH-resolution vector on Windows hosts. Only actionable if you run on Windows (incl. CI runners and dev machines), which is common enough in Laravel shops to warrant a check.REQUEST_*/CGI vars inside subprocesses will now see them absent; (b) any workflow passing array/object env values will now have them silently dropped — audit Process::setEnv()/constructor env arrays for non-scalars.cmd.exe fallback now absolute-pathed; MSYS escaping and environment variable limits (large arrays) remain OS-bounded — mitigate via chunking or platform-specific fallbacks.fromShellCommandline).8.1.0-BETA2) or an older 5.4 patch are exposed until they move. Confirm the equivalent fix has landed on whichever minor you actually run.#65738 CGI env-leak fix is present in our pinned version, and what is our patch SLA for security-tagged component releases?REQUEST_URI, proxy vars, or host-derived values)? Does any call site pass non-scalar env values that would now be silently dropped?#65784)?exec() wrappers that conflict?$this->app->singleton(Process::class, fn() => new Process([]));
Process::run('command')) to abstract Symfony’s API.php artisan my:command).RunProcessMessage for async subprocesses (e.g., background builds).RunProcessJob).Command class for structured CLI tools.#65739, centralize env construction in one helper that validates scalar-only env maps before calling Process::setEnv(), and logs discarded keys at debug level so silent drops are observable.exec(), shell_exec(), custom wrappers).setEnv() / constructor env array; flag non-scalars and any reliance on inherited CGI/REQUEST_* vars.symfony/process >= 5.4.54 on the 5.4 line (or the equivalent patched minor on 6.4/7.x/8.x) and ship it as a standalone security change — separate deploy from feature work so regressions are attributable.fromShellCommandline).#65738/#65739/#65784 fixes.>=5.4.54 is the concrete floor.8.1.0-BETA2 is not a substitute for a patched stable line; do not ship production on it to obtain these fixes.cmd.exe fallback path resolution after upgrade (#65784); re-check MSYS/WSL quirks (path escaping, environment limits).disable_functions in php.ini).composer require symfony/process:>=5.4.54 # or patched minor for your line
Verify via composer show symfony/process and lockfile diff review.ProcessHelper::run()), with scalar-env validation and discarded-key logging.Symfony\Component\Console\Command for Artisan commands.RunProcessJob class for Laravel Queues.#65738.cmd.exe resolution).symfony/process as a security-relevant dependency. Add it to a monitored advisory feed and a scheduled patch cadence; align with Laravel’s LTS schedule for major updates.>=5.4.54 on the 5.4 line) rather than loose ranges; keep a documented mapping of Laravel version → Symfony Process line → minimum patched build.5.4.54. Symfony Process remains a stable component; focus on adoption of security patches over feature chasing.5.4.54, request-context/CGI vars are intentionally not inherited (#65738). If a script depended on them, pass values explicitly via setEnv() — do not attempt to re-enable the leak.#65739, invalid names and non-scalar values are dropped. Check application logs for the wrapper’s discarded-key diagnostics; fix the caller, not the component.#65784 switches the cmd.exe fallback to an absolute path. Re-validate any custom PATH manipulation or shimmed cmd.exe in CI images.Process::fromShellCommandline() for PowerShell compatibility.setTimeout() and handle ProcessTimedOutException explicitly; emit a distinct log/metric so hangs are distinguishable from failures.git status); optimize long-running processes (e.g., builds) via streaming callbacks and explicit timeouts.#65738, workers no longer carry request context into children — a scaling win for isolation (fewer accidental cross-tenant values in logs/artifacts) and a reason to standardize on explicit env injection per job.#65739) → subprocess runs with missing configuration. Detection: wrapper-level discarded-key logging + startup assertion of required env keys.cmd.exe fallback changes → possible "command not found" in exotic CI images. Detection: smoke test on Windows runners.setTimeout() → stuck workers. Detection: timeout exception metrics + queue-job duration alerts.disable_functions or shared-hosting policy blocks proc_open → process creation fails at runtime. Detection: preflight capability check in the health endpoint.ProcessHelper wrapper, secure-env checklist, version-pinning policy, and a security-patch runbook naming owners and SLA.fromShellCommandline); ability to test on Windows and PHP-FPM/CGI targets, which is where 5.4.54's fixes actually bite.How can I help you explore Laravel packages today?