]> granicus.if.org Git - php/commitdiff
Avoid invalid array access in fcgi.inc
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Jul 2019 08:44:33 +0000 (10:44 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Wed, 10 Jul 2019 09:09:34 +0000 (11:09 +0200)
sapi/fpm/tests/fcgi.inc

index 7e3ad0514bb54463cc0f6c4633b5701f7f66072e..f31811aef6744cf0b6ae59b3f38fcfdbf3d71f59 100644 (file)
@@ -589,9 +589,7 @@ class Client
         // but still not get the response requested
         $startTime = microtime(true);
 
-        do {
-            $resp = $this->readPacket();
-
+        while ($resp = $this->readPacket()) {
             if ($resp['type'] == self::STDOUT || $resp['type'] == self::STDERR) {
                 if ($resp['type'] == self::STDERR) {
                     $this->_requests[$resp['requestId']]['state'] = self::REQ_STATE_ERR;
@@ -612,7 +610,7 @@ class Client
                 $this->set_ms_timeout($this->_readWriteTimeout);
                 throw new \Exception('Timed out');
             }
-        } while ($resp);
+        }
 
         if (!is_array($resp)) {
             $info = stream_get_meta_data($this->_sock);