slimphp / Slim

Slim is a PHP micro framework that helps you quickly write simple yet powerful web applications and APIs.
http://slimframework.com
MIT License
11.98k stars 1.95k forks source link

[Develop] Body Coupling #1269

Closed geggleto closed 9 years ago

geggleto commented 9 years ago

https://github.com/slimphp/Slim/blob/develop/Slim/App.php#L314

            if ($hasBody) {
                $body = $response->getBody(); //Returns the PSR Steam Interface
                if ($body->isAttached()) { //This method is NOT a part of the interface but is apart of the Slim\Http\Body
                    $body->rewind();
                    while (!$body->eof()) {
                        $settings = $this->container->get('settings');
                        echo $body->read($settings['responseChunkSize']);
                    }
                }
            }
codeguy commented 9 years ago

Good catch. I want to say that existed at one time, else it's a remnant from an earlier Guzzle stream implementation. Either way, this needs to go.

geggleto commented 9 years ago

@codeguy Is this part of the code responsible for outputting the response body ?

codeguy commented 9 years ago

Yes, it is the last stage in the app lifecycle which returns the content out of PHP to the upstream web server and on to the HTTP client. All isAttached() does is make sure there is still an underlying resource attached to the StreamInterface instance.

geggleto commented 9 years ago

I am going to wait to action this as I know the Slim\Http\Body object is changing with the UploadedFiles PSR implementation.

codeguy commented 9 years ago

@geggleto Sounds good

akrabat commented 9 years ago

Fixed via #1317