diff options
author | Máté Szabó <mszabo@wikimedia.org> | 2025-01-16 13:06:12 +0100 |
---|---|---|
committer | Máté Szabó <mszabo@wikimedia.org> | 2025-01-16 13:03:47 +0000 |
commit | 8b9c3ab08eddc86032166f5b9dc208e51c2aaebb (patch) | |
tree | 1b150ad520e2b6226f43122acbddba2b092c78b7 /maintenance | |
parent | a9d4d54f74d224cb068510c7715dbfa1ad46123d (diff) | |
download | mediawikicore-8b9c3ab08eddc86032166f5b9dc208e51c2aaebb.tar.gz mediawikicore-8b9c3ab08eddc86032166f5b9dc208e51c2aaebb.zip |
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
Diffstat (limited to 'maintenance')
-rw-r--r-- | maintenance/includes/TextPassDumper.php | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/maintenance/includes/TextPassDumper.php b/maintenance/includes/TextPassDumper.php index 0f23f8d1b1bc..8483c423b1bc 100644 --- a/maintenance/includes/TextPassDumper.php +++ b/maintenance/includes/TextPassDumper.php @@ -808,7 +808,7 @@ TEXT } $this->spawnErr = false; if ( $this->spawnProc ) { - pclose( $this->spawnProc ); + proc_close( $this->spawnProc ); } $this->spawnProc = false; AtEase::restoreWarnings(); |