From 1bef14a02a3aa22a7bf1c17ab19d4ba51151a277 Mon Sep 17 00:00:00 2001 From: Fabien Potencier Date: Mon, 6 Feb 2012 07:00:39 +0100 Subject: [PATCH] [Process] fixed usage of constants in closure --- src/Symfony/Component/Process/Process.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Symfony/Component/Process/Process.php b/src/Symfony/Component/Process/Process.php index 3364e6c2b7..f73b3c5d10 100644 --- a/src/Symfony/Component/Process/Process.php +++ b/src/Symfony/Component/Process/Process.php @@ -94,9 +94,11 @@ class Process $this->stdout = ''; $this->stderr = ''; $that = $this; - $callback = function ($type, $data) use ($that, $callback) + $out = self::OUT; + $err = self::ERR; + $callback = function ($type, $data) use ($that, $callback, $out, $err) { - if (self::OUT == $type) { + if ($out == $type) { $that->addOutput($data); } else { $that->addErrorOutput($data); @@ -159,7 +161,7 @@ class Process $type = array_search($pipe, $pipes); $data = fread($pipe, 8192); if (strlen($data) > 0) { - call_user_func($callback, $type == 1 ? self::OUT : self::ERR, $data); + call_user_func($callback, $type == 1 ? $out : $err, $data); } if (false === $data || feof($pipe)) { fclose($pipe);