{"record":{"id":"f7f72f755d878dd2","repo":"symfony/process","slug":"this-php-has-been-compiled-with-enable-sigchild-term-signal","errorCode":null,"errorMessage":"This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.","messagePattern":"This PHP has been compiled with --enable-sigchild\\. Term signal cannot be retrieved\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"warning","filePath":"Process.php","lineNumber":861,"sourceCode":"        $this->requireProcessIsTerminated(__FUNCTION__);\n\n        return $this->processInformation['signaled'];\n    }\n\n    /**\n     * Returns the number of the signal that caused the child process to terminate its execution.\n     *\n     * It is only meaningful if hasBeenSignaled() returns true.\n     *\n     * @throws RuntimeException In case --enable-sigchild is activated\n     * @throws LogicException   In case the process is not terminated\n     */\n    public function getTermSignal(): int\n    {\n        $this->requireProcessIsTerminated(__FUNCTION__);\n\n        if ($this->isSigchildEnabled() && -1 === $this->processInformation['termsig']) {\n            throw new RuntimeException('This PHP has been compiled with --enable-sigchild. Term signal cannot be retrieved.');\n        }\n\n        return $this->processInformation['termsig'];\n    }\n\n    /**\n     * Returns true if the child process has been stopped by a signal.\n     *\n     * It always returns false on Windows.\n     *\n     * @throws LogicException In case the process is not terminated\n     */\n    public function hasBeenStopped(): bool\n    {\n        $this->requireProcessIsTerminated(__FUNCTION__);\n\n        return $this->processInformation['stopped'];\n    }","sourceCodeStart":843,"sourceCodeEnd":879,"githubUrl":"https://github.com/symfony/process/blob/99b85026db14a68f02c6f3eeb01a1170ca25c491/Process.php#L843-L879","documentation":"getTermSignal() throws this RuntimeException when PHP was compiled with --enable-sigchild. In that configuration the operating system does not expose the child's termination signal to PHP, so the termsig value stays at -1 and cannot be reported. The library surfaces this platform limitation instead of returning a wrong signal.","triggerScenarios":"Calling getTermSignal() after the process terminated on a PHP built with --enable-sigchild, when processInformation['termsig'] is still -1.","commonSituations":"Older or custom-compiled PHP on exotic systems (historically HP-UX); Docker images built with sigchild-enabled PHP; code that inspects exit signals (e.g., detecting SIGKILL) which works on normal PHP but fails in such environments.","solutions":["Check isSigchildEnabled() before calling getTermSignal() and skip signal inspection on sigchild builds.","Rely on getExitCode()/isSuccessful() instead of term signal when possible.","Rebuild/choose a PHP without --enable-sigchild if signal information is required.","Wrap getTermSignal() in try-catch for RuntimeException and degrade gracefully."],"exampleFix":"// before\n$signal = $process->getTermSignal(); // RuntimeException on sigchild PHP\n\n// after\n$signal = \\Symfony\\Component\\Process\\Process::isSigchildEnabled() ? null : $process->getTermSignal();","handlingStrategy":"try-catch","validationCode":"$sigchild = \\Symfony\\Component\\Process\\Process::isSigchildEnabled();\nif (!$sigchild && $process->isTerminated()) {\n    $signal = $process->getTermSignal();\n}","typeGuard":null,"tryCatchPattern":"try {\n    $signal = $process->getTermSignal();\n} catch (\\RuntimeException $e) {\n    $signal = null; // sigchild PHP: term signal unavailable\n}","preventionTips":["Check Process::isSigchildEnabled() once at boot and branch your exit-status logic.","Base success decisions on getExitCode()/isSuccessful(), not term signal.","Pin CI and production to a PHP build without --enable-sigchild when signals matter."],"tags":["process","symfony","sigchild","platform-limitation","php-configuration"],"backgroundTag":"unsupported-platform","analyzedSha":"99b85026db14a68f02c6f3eeb01a1170ca25c491","analyzedAt":"2026-09-14T11:23:33.683Z","contentChangedAt":"2026-09-14T11:23:33.683Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}