From aa7eed2a0478af5b397732810c0e41c10208b0d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BB=A3=E7=A0=81=E4=B9=8B=E7=BE=8E?= Date: Wed, 31 Mar 2021 00:37:21 +0800 Subject: [PATCH] Fix further fclose errors with PHP 8 (#46) --- lib/Internal/Windows/Runner.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/Internal/Windows/Runner.php b/lib/Internal/Windows/Runner.php index 7684b63..af83e1a 100644 --- a/lib/Internal/Windows/Runner.php +++ b/lib/Internal/Windows/Runner.php @@ -216,12 +216,15 @@ final class Runner implements ProcessRunner $handle->stdin->close(); $handle->stdout->close(); $handle->stderr->close(); - foreach ($handle->sockets as $socket) { - @\fclose($socket); + if (\is_resource($socket)) { + @\fclose($socket); + } } - @\fclose($handle->wrapperStderrPipe); + if (\is_resource($handle->wrapperStderrPipe)) { + @\fclose($handle->wrapperStderrPipe); + } if (\is_resource($handle->proc)) { \proc_close($handle->proc);