Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[HttpFoundation] [PSR-7] Allow to use resources as content body and to return resources from string content #15249

Closed
wants to merge 3 commits into from

Conversation

dunglas
Copy link
Member

@dunglas dunglas commented Jul 9, 2015

Q A
Bug fix? yes
New feature? yes
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR not yet

Maybe should I open it against 2.8 but it can be considered a bug fix at least for the part "returning a string as a resource".

throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
}

if (true === $asResource) {
if (is_resource($this->content)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can reuse $currentContentIsResource

@dunglas
Copy link
Member Author

dunglas commented Jul 16, 2015

Should be OK now.


// Content passed in parameter (test)
if (is_string($this->content)) {
$resource = fopen('php://temp','r+');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after the comma.

@fabpot
Copy link
Member

fabpot commented Jul 16, 2015

👍

1 similar comment
@stof
Copy link
Member

stof commented Jul 16, 2015

👍

@fabpot
Copy link
Member

fabpot commented Jul 16, 2015

Thank you @dunglas.

fabpot added a commit that referenced this pull request Jul 16, 2015
… body and to return resources from string content (dunglas)

This PR was squashed before being merged into the 2.3 branch (closes #15249).

Discussion
----------

[HttpFoundation] [PSR-7] Allow to use resources as content body and to return resources from string content

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | not yet

* Allows to fix tests of https://github.com/symfony/psr-http-message-bridge with PHP 5.6.
* Ease the transition to PSR-7 (in PSR-7, almost everything is stream - #15186)

Maybe should I open it against 2.8 but it can be considered a bug fix at least for the part "returning a string as a resource".

Commits
-------

059964d [HttpFoundation] [PSR-7] Allow to use resources as content body and to return resources from string content
@fabpot fabpot closed this Jul 16, 2015
@dunglas dunglas deleted the fix_test_content_stream branch December 5, 2015 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants