From 1761b1b760610e02e5be777b5c6eb524bd434012 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1t=C3=A9=20Szab=C3=B3?= Date: Thu, 16 Jan 2025 13:06:12 +0100 Subject: [PATCH] dumps: Use proc_close() to close proc_open() subprocess Why: - TextPassDumper may spawn PHP subprocesses via proc_open() when invoked with --spawn. - The script uses pclose() to try and close these, which is incorrect, because the resource returned by proc_open() should be closed via proc_close().[1] - This causes a TypeError on PHP 8.1 and newer. What: - Use proc_close() to close the resource instead of pclose(). Test Plan: - Run `php maintenance/dumpBackup.php --current --stub | php maintenance/dumpTextPass.php --spawn` on a local test wiki using PHP 8.1 or newer. It should succeed. [1] https://www.php.net/manual/en/function.proc-open.php Bug: T382484 Change-Id: I66cd733cdbc1b8bc1470c14851a0700401c36d1e (cherry picked from commit 8b9c3ab08eddc86032166f5b9dc208e51c2aaebb) --- maintenance/includes/TextPassDumper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maintenance/includes/TextPassDumper.php b/maintenance/includes/TextPassDumper.php index c0c26b064ba..9c637348795 100644 --- a/maintenance/includes/TextPassDumper.php +++ b/maintenance/includes/TextPassDumper.php @@ -846,7 +846,7 @@ TEXT } $this->spawnErr = false; if ( $this->spawnProc ) { - pclose( $this->spawnProc ); + proc_close( $this->spawnProc ); } $this->spawnProc = false; AtEase::restoreWarnings();