diff --git a/flight/net/Request.php b/flight/net/Request.php index 67e416d..7233758 100644 --- a/flight/net/Request.php +++ b/flight/net/Request.php @@ -639,8 +639,7 @@ class Request $data[$keyName] = [$data[$keyName]]; } $data[$keyName][] = $value; - } - else { + } else { $data[$keyName] = $value; } continue; @@ -667,8 +666,7 @@ class Request if ($bytes === false) { $tmpFile['error'] = UPLOAD_ERR_CANT_WRITE; - } - else { + } else { // delete the temporary file before ended script register_shutdown_function(function () use ($tmpName): void { if (file_exists($tmpName)) { diff --git a/tests/RequestBodyParserTest.php b/tests/RequestBodyParserTest.php index 6b7ede3..55e3b5a 100644 --- a/tests/RequestBodyParserTest.php +++ b/tests/RequestBodyParserTest.php @@ -63,32 +63,8 @@ class RequestBodyParserTest extends TestCase private function assertUrlEncodedParsing(string $method): void { $body = 'foo=bar&baz=qux&key=value'; - $tmpfile = tmpfile(); - $stream_path = stream_get_meta_data($tmpfile)['uri']; - file_put_contents($stream_path, $body); - - $config = [ - 'url' => '/', - 'base' => '/', - 'method' => $method, - 'referrer' => '', - 'ip' => '127.0.0.1', - 'ajax' => false, - 'scheme' => 'http', - 'user_agent' => 'Test', - 'type' => 'application/x-www-form-urlencoded', - 'length' => strlen($body), - 'secure' => false, - 'accept' => '', - 'proxy_ip' => '', - 'host' => 'localhost', - 'servername' => 'localhost', - 'stream_path' => $stream_path, - 'data' => new Collection(), - 'query' => new Collection(), - 'cookies' => new Collection(), - 'files' => new Collection() - ]; + $tmpfile = null; + $config = $this->createRequestConfig($method, 'application/x-www-form-urlencoded', $body, $tmpfile); $request = new Request($config);