-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Conversation
243e145
to
8a34e7d
Compare
👍 |
@@ -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) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
Instead of closing it, what about documenting the change in the CHANGELOG/UPGRADE files and target 4.0? |
f9db833
to
81e0d5b
Compare
Let's do that. Target and CHANGELOG/UPGRADE files updated, this should be removed from the 3.3 milestone |
Changed the milestone to 4.0. |
But we can create a smooth upgrade path: let's deprecate |
46cb2c3
to
8b24706
Compare
@nicolas-grekas Updated, thank you. @fabpot Is it ok for you? |
4212d7e
to
62dfc3d
Compare
👍 |
protected $container; | ||
/** | ||
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below | ||
*/ | ||
protected $map; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be made private
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use ""
62dfc3d
to
2dc17a8
Compare
Milestone should be changed, again :) |
2dc17a8
to
f6c13a2
Compare
/** | ||
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below | ||
*/ | ||
private $map; | ||
protected $container; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
311f90f
to
b51d617
Compare
/** | ||
* @deprecated since version 3.3, to be removed in 4.0 alongside with magic methods below | ||
*/ | ||
private $map; | ||
protected $container; |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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?
6625b75
to
a171dbc
Compare
@nicolas-grekas deprecated using |
$this->map = $map; | ||
$this->contexts = new \SplObjectStorage(); | ||
$this->contextCache = new \SplObjectStorage(); | ||
$this->contextMap = $contextMap; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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
7c27a67
to
d2e0798
Compare
There was a problem hiding this 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: should be _FirewallMap
There was a problem hiding this comment.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra space before and
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
d2e0798
to
5b72cf6
Compare
Thank you @chalasr. |
…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
…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
Uh oh!
There was an error while loading. Please reload this page.