Skip to content

Commit

Permalink
Unpack child result array
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcHagen authored Aug 28, 2024
1 parent 92f8b6d commit 212e822
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/Process/ParallelProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,15 @@ public function getOutput()
if (! $this->output) {
$processOutput = $this->process->getOutput();

$this->output = @unserialize(base64_decode($processOutput));
$childResult = @unserialize(base64_decode($processOutput));

if (! $this->output) {
if ($childResult === false || !is_string($childResult['output'])) {
$this->errorOutput = $processOutput;

return null;
}

$this->output = $childResult['output'];
}

return $this->output;
Expand All @@ -83,11 +87,13 @@ public function getErrorOutput()
if (! $this->errorOutput) {
$processOutput = $this->process->getErrorOutput();

$this->errorOutput = @unserialize(base64_decode($processOutput));
$childResult = @unserialize(base64_decode($processOutput));

if (! $this->errorOutput) {
if ($childResult === false || !is_string($childResult['output'])) {
$this->errorOutput = $processOutput;
}
} else {
$this->errorOutput = $childResult['output'];
}
}

return $this->errorOutput;
Expand Down

0 comments on commit 212e822

Please sign in to comment.