diff --git a/src/Process/ParallelProcess.php b/src/Process/ParallelProcess.php index b36040a..c27155c 100644 --- a/src/Process/ParallelProcess.php +++ b/src/Process/ParallelProcess.php @@ -68,15 +68,15 @@ public function getOutput() if (! $this->output) { $processOutput = $this->process->getOutput(); - $childResult = @unserialize(base64_decode($processOutput)); + $childResult = @unserialize(base64_decode($processOutput)); if ($childResult === false || ! array_key_exists('output', $childResult)) { $this->errorOutput = $processOutput; - return null; + return null; } - $this->output = $childResult['output']; + $this->output = $childResult['output']; } return $this->output; @@ -87,13 +87,13 @@ public function getErrorOutput() if (! $this->errorOutput) { $processOutput = $this->process->getErrorOutput(); - $childResult = @unserialize(base64_decode($processOutput)); + $childResult = @unserialize(base64_decode($processOutput)); if ($childResult === false || ! array_key_exists('output', $childResult)) { $this->errorOutput = $processOutput; - } else { - $this->errorOutput = $childResult['output']; - } + } else { + $this->errorOutput = $childResult['output']; + } } return $this->errorOutput; diff --git a/src/Runtime/ChildRuntime.php b/src/Runtime/ChildRuntime.php index 47f4c46..e0cbc4a 100644 --- a/src/Runtime/ChildRuntime.php +++ b/src/Runtime/ChildRuntime.php @@ -4,7 +4,7 @@ // php://stdout does not obey output buffering. Any output would break // unserialization of child process results in the parent process. -if (!defined('STDOUT')) { +if (! defined('STDOUT')) { define('STDOUT', fopen('php://temp', 'w+b')); define('STDERR', fopen('php://stderr', 'wb')); } diff --git a/tests/ChildRuntimeTest.php b/tests/ChildRuntimeTest.php index f63fe70..2e761e1 100644 --- a/tests/ChildRuntimeTest.php +++ b/tests/ChildRuntimeTest.php @@ -16,6 +16,7 @@ public function it_can_run() $serializedClosure = base64_encode(serialize(new SerializableClosure(function () { echo 'interfere with output'; + return 'child'; })));