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

Provide less state in getRequestFormat #21805

Closed

Conversation

dawehner
Copy link
Contributor

Let's assume you multiple lines of code calling to Request::getRequestFormatproviding different default values.

$request->getRequestFormat();
$request->getRequestFormat('json')

As of HEAD this causes the second call to return 'html', unless its set explicit via setRequestFormat().

IMHO this is state which can be avoided.

Note: This also helps Drupal.

Q A
Branch? 2.7
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? no
Fixed tickets
License MIT
Doc PR

@fabpot
Copy link
Member

fabpot commented Feb 28, 2017

LGTM, should be merged in 2.7 though (can you change the branch target of the PR?)

@nicolas-grekas nicolas-grekas added this to the 2.7 milestone Mar 4, 2017
@nicolas-grekas
Copy link
Member

Thank you @dawehner.

nicolas-grekas added a commit that referenced this pull request Mar 4, 2017
This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #21805).

Discussion
----------

Provide less state in getRequestFormat

Let's assume you multiple lines of code calling to ```Request::getRequestFormat```providing different default values.

```
$request->getRequestFormat();
$request->getRequestFormat('json')
```

As of HEAD this causes the second call to return 'html', unless its set explicit via ```setRequestFormat()```.

IMHO this is state which can be avoided.

Note: This also helps Drupal.

| Q             | A
| ------------- | ---
| Branch?       | 2.7
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets |
| License       | MIT
| Doc PR        |

Commits
-------

1d43007 Provide less state in getRequestFormat
@dawehner
Copy link
Contributor Author

dawehner commented Mar 4, 2017

@fabpot Sorry for not finding the time to update the PR
@nicolas-grekas Thank you for fixing it properly :)

This was referenced Mar 6, 2017
danrot pushed a commit to sulu/sulu that referenced this pull request Mar 21, 2017
* Fix check in MarkupListener

An update in Symfony has changed the way the request format is returned. This
has broken a check in the MarkupBundle and prevents it from running at all.
Removing the 'null' parameter from the function call fixes the issue but needs
more testing.

Related change in Symfony:
symfony/symfony#21805

* Changelog update

* added fix for BinaryFileResponse
danrot pushed a commit to sulu/sulu that referenced this pull request Mar 23, 2017
* Fix check in MarkupListener

An update in Symfony has changed the way the request format is returned. This
has broken a check in the MarkupBundle and prevents it from running at all.
Removing the 'null' parameter from the function call fixes the issue but needs
more testing.

Related change in Symfony:
symfony/symfony#21805

* Changelog update

* added fix for BinaryFileResponse
@dominikzogg
Copy link

please do not break things within bugfix releases, we need to provide content-type: application/json even on emtpy responses (i know its against the specs) but it sould be possible to do so

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

6 participants