Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[HttpFoundation] deprecated finding deep items in Request and ParameterBag #14203

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

Closed
wants to merge 503 commits into from

Conversation

xabbuh
Copy link
Member

@xabbuh xabbuh commented Apr 3, 2015

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

@xabbuh xabbuh force-pushed the deprecate-deep-get branch from f55c2af to 64ec8b4 Compare April 3, 2015 16:19
@stof
Copy link
Member

stof commented Apr 3, 2015

the Security component is relying on this feature IIRC

@xabbuh
Copy link
Member Author

xabbuh commented Apr 3, 2015

Indeed, thanks for noticing. I check this.

@fabpot
Copy link
Member

fabpot commented Apr 3, 2015

Big 👍 from me. @xabbuh Can you reference the original ticket here as well?

@xabbuh
Copy link
Member Author

xabbuh commented Apr 3, 2015

@fabpot I got aware of this by #14039 (though this pull request doesn't really "fix" that issue).

@xabbuh xabbuh force-pushed the deprecate-deep-get branch from 64ec8b4 to 01cdfe4 Compare April 3, 2015 17:36
@xabbuh
Copy link
Member Author

xabbuh commented Apr 3, 2015

I updated the Security component. Let's see what the tests say.

@shoomyth
Copy link

shoomyth commented Apr 3, 2015

IMO 3rdparty libs/frameworks rely on this feature. Maybe it makes sense at least to move RequestUtils to HttpFoundation?

@xabbuh xabbuh force-pushed the deprecate-deep-get branch from 01cdfe4 to 73c783a Compare April 3, 2015 20:42
@xabbuh
Copy link
Member Author

xabbuh commented Apr 3, 2015

IMO 3rdparty libs/frameworks rely on this feature.

Libraries currently relying on this, will have time to update their code to deal with it when the breaking change will be done in 3.0.

Maybe it makes sense at least to move RequestUtils to HttpFoundation?

I don't think that this would be a good idea. We would then have to maintain the code again (just not in the Request class itself). Instead, I marked the class as internal so that we can safely remove it later if we want to.

@xabbuh
Copy link
Member Author

xabbuh commented Apr 3, 2015

Remaining failures should be fixed with #14197 soon.

public static function getDeepParameter(Request $request, $path)
{
if (false === $pos = strpos($path, '[')) {
return $request->get($path, null);
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 omit the second argument. It is already the default

@stof
Copy link
Member

stof commented Apr 4, 2015

Well, if the Security component needs it, it mean we cannot drop the logic entirely anyway. And given you moved it to a separate component, it even mean we have to maintain it twice for now, because the BC layer cannot reuse the RequestUtils class

@xabbuh xabbuh force-pushed the deprecate-deep-get branch 2 times, most recently from 9eff960 to a83a2da Compare April 10, 2015 08:40
@xabbuh
Copy link
Member Author

xabbuh commented Apr 10, 2015

You're right. I moved the utility class to the HttpFoundation component and removed the duplicated logic from the ParameterBag class. This way, we can think about finding another solution for the Security component or decide to move the logic there in Symfony 3.0.

@xabbuh xabbuh force-pushed the deprecate-deep-get branch 4 times, most recently from 33b5708 to 26ba680 Compare April 10, 2015 17:38
*/
public function get($key, $default = null, $deep = false)
{
if (true === $deep) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't false !== $deep more suitable for this check? Or even better, something like false !== $deep || func_num_args() > 2 to check if $deep argument is passed regardless its value and avoiding the impact of calling a function when the value isn't the default one.

@xabbuh
Copy link
Member Author

xabbuh commented Apr 13, 2015

@fabpot @stof Can we still merge this even if the first beta for Symfony 2.7 has been released?

@fabpot
Copy link
Member

fabpot commented Apr 13, 2015

It's going to be in 2.8 for now. Sorry about that, but we don't merge anything new after the first beta, except fro "big" problems.

@xabbuh xabbuh force-pushed the deprecate-deep-get branch from 26ba680 to 34e4e73 Compare June 2, 2015 08:15
@xabbuh
Copy link
Member Author

xabbuh commented Jun 2, 2015

I think we should reconsider this again for Symfony 2.8 given that 2.7 is released now.

ping @symfony/deciders

@xabbuh xabbuh added the Ready label Jun 2, 2015
@@ -99,54 +99,20 @@ public function add(array $parameters = array())
* @throws \InvalidArgumentException
*
* @api
*
* @deprecated Finding deep items is deprecated since version 2.7, to be removed in 3.0.
Copy link
Contributor

Choose a reason for hiding this comment

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

Since the method itself is not deprecated we should avoid using @deprecated tag here.

@jakzal
Copy link
Contributor

jakzal commented Jun 2, 2015

I'm all in for deprecating this feature.

@xabbuh xabbuh force-pushed the deprecate-deep-get branch from 34e4e73 to 57c3c24 Compare June 2, 2015 08:43
xabbuh and others added 20 commits September 28, 2015 20:15
In symfony#15973, the `searchResultsAction()` of the `ProfilerController` was
updated to pass the current request to the rendered template. However,
this change was not reflected in the test thus letting it fail.
…t (xabbuh)

This PR was merged into the 2.8 branch.

Discussion
----------

[WebProfilerBundle] reflect latest changes in test

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

In symfony#15973, the `searchResultsAction()` of the `ProfilerController` was
updated to pass the current request to the rendered template. However,
this change was not reflected in the test thus letting it fail.

Commits
-------

ae283e8 [WebProfilerBundle] reflect latest changes in test
…s (xabbuh)

This PR was merged into the 2.8 branch.

Discussion
----------

[Security] fix tests for the `AbstractVoter` class

| Q             | A
| ------------- | ---
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#15961, symfony#15968
| License       | MIT
| Doc PR        |

* The `LegacyAbstractVoterTest` class is not needed anymore, tests have
  been moved to the `AbstractVoterTest` class tagging them with the
  legacy group.
* Tests are applied on `stdClass` object instances. Thus, the legacy
  voter fixture class must not support `AbstractVoterTest_Object`
  instances, but support `stdClass` objects instead.
* Remove a test that checked for a `BadMethodCallException` being
  thrown. This seems to have been added accidentally in symfony#15961.

Commits
-------

9fe3b76 fix tests for the `AbstractVoter` class
…mand and apply Symfony styles (1ed)

This PR was submitted for the 2.7 branch but it was merged into the 2.8 branch instead (closes symfony#14235).

Discussion
----------

[FrameworkBundle] Refactored assets:install command and apply Symfony styles

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

Replaces symfony#13057

![screenshot from 2015-04-06 17 26 47](https://cloud.githubusercontent.com/assets/162986/7006783/242312f0-dc84-11e4-80ae-7d584ceae2f2.png)
![screenshot from 2015-04-06 17 26 16](https://cloud.githubusercontent.com/assets/162986/7006784/24237ff6-dc84-11e4-9678-ca5afe4b73fe.png)
![screenshot from 2015-04-09 10 24 59](https://cloud.githubusercontent.com/assets/162986/7063056/96c71baa-dea3-11e4-981c-a4ef4fa59cfb.png)
![screenshot from 2015-04-06 17 33 46](https://cloud.githubusercontent.com/assets/162986/7006782/2421e22c-dc84-11e4-9d1f-c1b91a7c0abe.png)
![screenshot from 2015-04-06 20 14 57](https://cloud.githubusercontent.com/assets/162986/7009308/a1aae2e2-dc99-11e4-9c00-c1f60bc55abf.png)

Commits
-------

8b7b251 [FrameworkBundle] Refactor assets:install command and apply SymfonyStyle
…ent (stof)

This PR was merged into the 2.8 branch.

Discussion
----------

Add a non-static API for the CssSelector component

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | no
| Deprecations? | yes
| Tests pass?   | yes
| Fixed tickets | symfony#15850, symfony#8404
| License       | MIT
| Doc PR        | todo

This implements a non-static API for the CssSelector component.

I decided to keep the static API too, as it is convenient when you just need a one-shot conversion (if you need lots of conversions, keeping a reference to the Converter and all its internal object graph may be faster than releasing it all the time and rebuilding it).
I deprecated the global state to choose between HTML and XML conversion. The static API would always enable the HTML extension in 3.0. Dealing with XML would be done by using the Converter class.

A second commit also tags all internal classes of the component as ``@internal``, as there is really no reason for a user to deal with them (btw, we already considered them fully internal in the past, as we broke BC on them in a patch release to fix memory performance of the component in the past).

TODOs:

- [x] Validate whether we keep the static facade to the component
- [ ] send a PR on the documentation to document this new API.
- [x]  handle usage of the deprecated API in the DomCrawler testsuite

The DomCrawler component does not use the new API yet. I will do it in a separate PR, as distinguishing between HTML and XML modes for a crawler will be easier once I deprecate the possibility to load multiple documents (which I will do tomorrow).

Commits
-------

9e51279 [CssSelector] Tag all internal classes as internal ones
f4563c3 Add a non-static API for the CssSelector component
…constraint (enumag)

This PR was submitted for the 2.3 branch but it was merged into the 2.8 branch instead (closes symfony#15919).

Discussion
----------

[Form] Guess currency field based on validator constraint

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

Commits
-------

2993b00 [Form] Guess currency field based on validator constraint
This PR was squashed before being merged into the 2.8 branch (closes symfony#15964).

Discussion
----------

Symfony Console Style tweaks

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

This PR will contain some minor tweaks found while updating all the Symfony commands. Don't merge yet. Thanks!

Commits
-------

64e7b6f Symfony Console Style tweaks
…ands (javiereguiluz)

This PR was squashed before being merged into the 2.8 branch (closes symfony#15972).

Discussion
----------

[Console] Updated the styles of the server commands

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

This PR uses `comment()` which hasn't been merged yet. WIP PR at symfony#15964

![server_comparison_1](https://cloud.githubusercontent.com/assets/73419/10139550/a5dc0d70-6603-11e5-8b4c-30cae7f52232.png)

![server_comparison_2](https://cloud.githubusercontent.com/assets/73419/10139552/a82932f6-6603-11e5-9bf5-7d0944a98327.png)

Commits
-------

4e2cc0f [Console] Updated the styles of the server commands
…reguiluz)

This PR was merged into the 2.8 branch.

Discussion
----------

Updated the styles of the cache commands

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

This PR uses comment() which hasn't been merged yet. WIP PR at symfony#15964

![cache_1](https://cloud.githubusercontent.com/assets/73419/10141826/f41d5952-660e-11e5-8435-b78aef4130bb.png)

![cache_2](https://cloud.githubusercontent.com/assets/73419/10141828/f6da7e40-660e-11e5-80a9-3546e912bc0f.png)

![cache_3](https://cloud.githubusercontent.com/assets/73419/10141831/f9dea92c-660e-11e5-9c1f-3be42a263696.png)

Commits
-------

44c5416 Updated the styles for the "cache:warmup" command
08b2959 Updated the style for the "cache:clear" command
…buh)

This PR was merged into the 2.8 branch.

Discussion
----------

[Ldap] add some missing license file headers

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony#14602 (comment)
| License       | MIT
| Doc PR        |

Commits
-------

2b90fcf [Ldap] add some missing license file headers
This PR was merged into the 2.8 branch.

Discussion
----------

add replace rule for new Ldap component

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

Commits
-------

1aa884c add replace rule for new Ldap component
Conflicts:
	src/Symfony/Component/Console/Application.php
	src/Symfony/Component/Console/Command/Command.php
	src/Symfony/Component/Console/Formatter/OutputFormatter.php
	src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
	src/Symfony/Component/Console/Input/Input.php
	src/Symfony/Component/Console/Input/InputArgument.php
	src/Symfony/Component/Console/Input/InputDefinition.php
	src/Symfony/Component/Console/Input/InputOption.php
	src/Symfony/Component/Console/Output/OutputInterface.php
	src/Symfony/Component/Console/Output/StreamOutput.php
	src/Symfony/Component/CssSelector/CssSelector.php
	src/Symfony/Component/DependencyInjection/Container.php
	src/Symfony/Component/DependencyInjection/ContainerBuilder.php
	src/Symfony/Component/DependencyInjection/ContainerInterface.php
	src/Symfony/Component/DependencyInjection/Definition.php
	src/Symfony/Component/DependencyInjection/Scope.php
	src/Symfony/Component/DependencyInjection/ScopeInterface.php
	src/Symfony/Component/Validator/Constraints/Currency.php
	src/Symfony/Component/Validator/Constraints/CurrencyValidator.php
@xabbuh xabbuh force-pushed the deprecate-deep-get branch 4 times, most recently from 322fddb to f128f5a Compare September 29, 2015 21:39
@xabbuh
Copy link
Member Author

xabbuh commented Sep 29, 2015

see #16007

@xabbuh xabbuh closed this Sep 29, 2015
fabpot added a commit that referenced this pull request Sep 30, 2015
…st parameters (xabbuh)

This PR was merged into the 2.8 branch.

Discussion
----------

[HttpFoundation] deprecate finding deep items in request parameters

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

This is the same as #14203 but using the PropertyAccess component in the Security HTTP component to query nested request parameters and is rebased on the `2.8` branch.

Commits
-------

47fba88 deprecate finding deep items in request parameters
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.