From 48bad913268c8cafabbf7034b39c8bb24fbc5ab8 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 11 Sep 2025 10:16:56 +0200 Subject: [PATCH] Replace __sleep/wakeup() by __(un)serialize() for throwing and internal usages --- Pipes/UnixPipes.php | 4 ++-- Pipes/WindowsPipes.php | 4 ++-- Process.php | 7 ++----- 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Pipes/UnixPipes.php b/Pipes/UnixPipes.php index a0e48dd3..8838c68a 100644 --- a/Pipes/UnixPipes.php +++ b/Pipes/UnixPipes.php @@ -35,12 +35,12 @@ public function __construct(?bool $ttyMode, bool $ptyMode, mixed $input, bool $h parent::__construct($input); } - public function __sleep(): array + public function __serialize(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } - public function __wakeup(): void + public function __unserialize(array $data): void { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); } diff --git a/Pipes/WindowsPipes.php b/Pipes/WindowsPipes.php index 9124f412..bec37358 100644 --- a/Pipes/WindowsPipes.php +++ b/Pipes/WindowsPipes.php @@ -88,12 +88,12 @@ public function __construct(mixed $input, bool $haveReadSupport) parent::__construct($input); } - public function __sleep(): array + public function __serialize(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } - public function __wakeup(): void + public function __unserialize(array $data): void { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); } diff --git a/Process.php b/Process.php index dda43d4a..ce730f98 100644 --- a/Process.php +++ b/Process.php @@ -194,15 +194,12 @@ public static function fromShellCommandline(string $command, ?string $cwd = null return $process; } - public function __sleep(): array + public function __serialize(): array { throw new \BadMethodCallException('Cannot serialize '.__CLASS__); } - /** - * @return void - */ - public function __wakeup() + public function __unserialize(array $data): void { throw new \BadMethodCallException('Cannot unserialize '.__CLASS__); }