Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[SecurityBundle] Lazy load request matchers in FirewallMap #21451

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

Merged
merged 1 commit into from
Jan 31, 2017

Conversation

chalasr
Copy link
Member

@chalasr chalasr commented Jan 29, 2017

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

@nicolas-grekas
Copy link
Member

👍

@@ -28,7 +28,7 @@ class FirewallMap implements FirewallMapInterface
protected $map;
private $contexts;

public function __construct(ContainerInterface $container, array $map)
public function __construct(ContainerInterface $container, $map)
Copy link
Member

Choose a reason for hiding this comment

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

map is protected, not private. So, that's a BC break.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there any possible upgrade path?

Copy link
Member Author

Choose a reason for hiding this comment

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

Or is it acceptable if documented? I'll close if nothing can be done

Copy link
Member

Choose a reason for hiding this comment

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

I doubt many users are actually overriding this class (perhaps JMS security bundle?) but I would do it only in 4.0 with proper docs.

Copy link
Member Author

Choose a reason for hiding this comment

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

perhaps JMS security bundle

Even not. Let's close then

@chalasr chalasr closed this Jan 30, 2017
@chalasr chalasr deleted the firewall/lazy-contexts branch January 30, 2017 16:21
@fabpot
Copy link
Member

fabpot commented Jan 30, 2017

Instead of closing it, what about documenting the change in the CHANGELOG/UPGRADE files and target 4.0?

@chalasr chalasr restored the firewall/lazy-contexts branch January 30, 2017 16:23
@chalasr chalasr reopened this Jan 30, 2017
@chalasr chalasr force-pushed the firewall/lazy-contexts branch 2 times, most recently from f9db833 to 81e0d5b Compare January 30, 2017 16:32
@chalasr
Copy link
Member Author

chalasr commented Jan 30, 2017

Let's do that. Target and CHANGELOG/UPGRADE files updated, this should be removed from the 3.3 milestone

@fabpot fabpot modified the milestones: 4.0, 3.3 Jan 30, 2017
@fabpot
Copy link
Member

fabpot commented Jan 30, 2017

Changed the milestone to 4.0.

@nicolas-grekas
Copy link
Member

But we can create a smooth upgrade path: let's deprecate $map.
See #20769 for inspiration.

@chalasr chalasr force-pushed the firewall/lazy-contexts branch 2 times, most recently from 46cb2c3 to 8b24706 Compare January 30, 2017 17:11
@chalasr
Copy link
Member Author

chalasr commented Jan 30, 2017

@nicolas-grekas Updated, thank you.

@fabpot Is it ok for you?

@chalasr chalasr force-pushed the firewall/lazy-contexts branch 2 times, most recently from 4212d7e to 62dfc3d Compare January 30, 2017 17:16
@fabpot
Copy link
Member

fabpot commented Jan 30, 2017

👍

protected $container;
/**
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below
*/
protected $map;
Copy link
Member

Choose a reason for hiding this comment

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

should be made private

Copy link
Member Author

Choose a reason for hiding this comment

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

Better indeed :)

public function __get($name)
{
if ('map' === $name) {
@trigger_error(sprintf('Using the "%1$s::$map" property is deprecated since version 3.3 as it will be removed in 4.0. Use "%1$s::$contextMap" instead.', __CLASS__), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

should we do an $this->map = iterator_to_array($this->contextMap, false) when appropriate?

Copy link
Member

Choose a reason for hiding this comment

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

also: contextMap is private, so it can't be used "instead". any other suggestions?

Copy link
Member Author

Choose a reason for hiding this comment

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

should we do an $this->map = iterator_to_array($this->contextMap, false) when appropriate?

👍 though you say $use_keys = false but keys are important here, done

also: contextMap is private, so it can't be used "instead". any other suggestions?

nope, fixed

public function __isset($name)
{
if ('map' === $name) {
@trigger_error(sprintf('Using the "%1$s::$map" property is deprecated since version 3.3 as it will be removed in 4.0. Use ""', __CLASS__), E_USER_DEPRECATED);
Copy link
Member

Choose a reason for hiding this comment

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

use ""

@chalasr chalasr force-pushed the firewall/lazy-contexts branch from 62dfc3d to 2dc17a8 Compare January 30, 2017 18:19
@chalasr
Copy link
Member Author

chalasr commented Jan 30, 2017

Milestone should be changed, again :)

@chalasr chalasr force-pushed the firewall/lazy-contexts branch from 2dc17a8 to f6c13a2 Compare January 30, 2017 19:34
@nicolas-grekas nicolas-grekas added this to the 3.3 milestone Jan 30, 2017
@nicolas-grekas nicolas-grekas removed this from the 4.0 milestone Jan 30, 2017
/**
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below
*/
private $map;
protected $container;
Copy link
Member

Choose a reason for hiding this comment

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

so, no deprecation of this prop?

Copy link
Member Author

Choose a reason for hiding this comment

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

Another IteratorArgument as locator could do the job. WDYT?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in my last commit, let me know if I should revert or keep

Copy link
Member Author

@chalasr chalasr Jan 30, 2017

Choose a reason for hiding this comment

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

Oops, nevermind. That does not work. Definitely needs #20658 for that. Sorry for the noise

@chalasr chalasr force-pushed the firewall/lazy-contexts branch 2 times, most recently from 311f90f to b51d617 Compare January 30, 2017 21:06
/**
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below
*/
private $map;
protected $container;
Copy link
Member

Choose a reason for hiding this comment

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

Still, does this prop need to be protected?

if ('map' === $name) {
@trigger_error(sprintf('Using the "%s::$map" property is deprecated since version 3.3 as it will be removed in 4.0.', __CLASS__), E_USER_DEPRECATED);

if ($this->contextMap instanceof \Iterator) {
Copy link
Member

Choose a reason for hiding this comment

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

missing null === $this->map check?

@chalasr chalasr force-pushed the firewall/lazy-contexts branch 3 times, most recently from 6625b75 to a171dbc Compare January 31, 2017 08:24
@chalasr
Copy link
Member Author

chalasr commented Jan 31, 2017

@nicolas-grekas deprecated using $container and addressed your comments.

$this->map = $map;
$this->contexts = new \SplObjectStorage();
$this->contextCache = new \SplObjectStorage();
$this->contextMap = $contextMap;
Copy link
Member

Choose a reason for hiding this comment

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

do we really need to change the name of these props? we'd better keep it as is for a small diff if we can

Copy link
Member Author

@chalasr chalasr Jan 31, 2017

Choose a reason for hiding this comment

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

Reverted $contextCache to $contexts. About $contextMap if we want to keep it called $map we can't do null === $this->map and return the iterator as array, right? I think we can't

@chalasr chalasr force-pushed the firewall/lazy-contexts branch 2 times, most recently from 7c27a67 to d2e0798 Compare January 31, 2017 19:42
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

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

👍

@@ -22,13 +22,94 @@
*
* @author Johannes M. Schmitt <schmittjoh@gmail.com>
*/
class FirewallMap implements FirewallMapInterface
class FirewallMap extends _FireWallMap implements FirewallMapInterface
Copy link
Member

Choose a reason for hiding this comment

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

Typo: should be _FirewallMap

Copy link
Member Author

Choose a reason for hiding this comment

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

good catch

3.3.0
-----

* Deprecated the `FirewallMap::$map` and `$container` properties.
Copy link
Member

Choose a reason for hiding this comment

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

extra space before and

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

@chalasr chalasr force-pushed the firewall/lazy-contexts branch from d2e0798 to 5b72cf6 Compare January 31, 2017 20:20
@fabpot
Copy link
Member

fabpot commented Jan 31, 2017

Thank you @chalasr.

@fabpot fabpot merged commit 5b72cf6 into symfony:master Jan 31, 2017
fabpot added a commit that referenced this pull request Jan 31, 2017
…lMap (chalasr)

This PR was merged into the 3.3-dev branch.

Discussion
----------

[SecurityBundle] Lazy load request matchers in FirewallMap

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

Commits
-------

5b72cf6 [Security] Lazy load request matchers
@fabpot fabpot mentioned this pull request May 1, 2017
@chalasr chalasr deleted the firewall/lazy-contexts branch May 10, 2017 16:45
nicolas-grekas added a commit that referenced this pull request May 21, 2017
…sses (chalasr)

This PR was merged into the 4.0-dev branch.

Discussion
----------

Remove deprecated container injections and compiler passes

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | yes
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | ~~#21451 #21625 #21284 #22010~~ #22805
| License       | MIT
| Doc PR        | n/a

Commits
-------

16a2fcf Remove deprecated container injections and compiler passes
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.

4 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.