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)
This commit is contained in:
Máté Szabó 2025-01-16 13:06:12 +01:00 committed by Krinkle
parent ac62dc3d71
commit 1761b1b760

View file

@ -846,7 +846,7 @@ TEXT
}
$this->spawnErr = false;
if ( $this->spawnProc ) {
pclose( $this->spawnProc );
proc_close( $this->spawnProc );
}
$this->spawnProc = false;
AtEase::restoreWarnings();