From 3d1d52f9774d73060189edfc79f0c43345cc7112 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Fri, 4 Sep 2026 18:35:53 +0200 Subject: [PATCH] [Parallel] Guard uninitialized encoder in ParallelProcess::quit() A process spawned into the pool but not yet bound to its connection has no encoder set. When quitAll() runs after an error (e.g. timeout) it calls quit() on every pooled process, hitting "Typed property $encoder must not be accessed before initialization". Guard the encoder access. Fixes rectorphp/rector#9885 Claude-Session: https://claude.ai/code/session_01BhpDMF7ffeFv6sjaPqEZzc --- src/Parallel/ValueObject/ParallelProcess.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Parallel/ValueObject/ParallelProcess.php b/src/Parallel/ValueObject/ParallelProcess.php index 914f03eeacc..d9a105071ff 100644 --- a/src/Parallel/ValueObject/ParallelProcess.php +++ b/src/Parallel/ValueObject/ParallelProcess.php @@ -116,7 +116,11 @@ public function quit(): void $pipe->close(); } - $this->encoder->end(); + // the process can be quit before its connection is bound, e.g. on quitAll() after an error; + // in that case the encoder was never set + if (isset($this->encoder)) { + $this->encoder->end(); + } } public function bindConnection(Decoder $decoder, Encoder $encoder): void