Skip to content

Commit ed2c645

Browse files
Merge branch '7.2' into 7.3
* 7.2: [Process] Fix process status tracking Prevent empty request body stream in HttplugClient and Psr18Client [Lock] Fix Predis error handling [HttpClient] Fix buffering AsyncResponse with no passthru [TypeInfo] Fix promoted property phpdoc reading [HttpClient] Fix retrying requests with Psr18Client and NTLM connections [HttpClient] Fix uploading files > 2GB [Mime] use isRendered method to avoid rendering an email twice
2 parents 724e6c6 + 26a0819 commit ed2c645

File tree

2 files changed

+6
-15
lines changed

2 files changed

+6
-15
lines changed

Process.php

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ class Process implements \IteratorAggregate
8282
private WindowsPipes|UnixPipes $processPipes;
8383

8484
private ?int $latestSignal = null;
85-
private ?int $cachedExitCode = null;
8685

8786
private static ?bool $sigchild = null;
8887
private static array $executables = [];
@@ -1324,21 +1323,10 @@ protected function updateStatus(bool $blocking): void
13241323
return;
13251324
}
13261325

1327-
$this->processInformation = proc_get_status($this->process);
1328-
$running = $this->processInformation['running'];
1329-
1330-
// In PHP < 8.3, "proc_get_status" only returns the correct exit status on the first call.
1331-
// Subsequent calls return -1 as the process is discarded. This workaround caches the first
1332-
// retrieved exit status for consistent results in later calls, mimicking PHP 8.3 behavior.
1333-
if (\PHP_VERSION_ID < 80300) {
1334-
if (!isset($this->cachedExitCode) && !$running && -1 !== $this->processInformation['exitcode']) {
1335-
$this->cachedExitCode = $this->processInformation['exitcode'];
1336-
}
1337-
1338-
if (isset($this->cachedExitCode) && !$running && -1 === $this->processInformation['exitcode']) {
1339-
$this->processInformation['exitcode'] = $this->cachedExitCode;
1340-
}
1326+
if ($this->processInformation['running'] ?? true) {
1327+
$this->processInformation = proc_get_status($this->process);
13411328
}
1329+
$running = $this->processInformation['running'];
13421330

13431331
$this->readPipes($running && $blocking, '\\' !== \DIRECTORY_SEPARATOR || !$running);
13441332

Tests/ProcessTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -732,6 +732,9 @@ public function testProcessIsSignaledIfStopped()
732732
if ('\\' === \DIRECTORY_SEPARATOR) {
733733
$this->markTestSkipped('Windows does not support POSIX signals');
734734
}
735+
if (\PHP_VERSION_ID < 80300 && isset($_SERVER['GITHUB_ACTIONS'])) {
736+
$this->markTestSkipped('Transient on GHA with PHP < 8.3');
737+
}
735738

736739
$process = $this->getProcessForCode('sleep(32);');
737740
$process->start();

0 commit comments

Comments
 (0)