-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[SecurityBundle] Lazy load security listeners #23114
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
abcbb4b
to
f3bbf31
Compare
@@ -25,7 +25,7 @@ class FirewallContext | |||
private $exceptionListener; | |||
private $config; | |||
|
|||
public function __construct(array $listeners, ExceptionListener $exceptionListener = null, FirewallConfig $config = null) | |||
public function __construct(/* iterable */ $listeners, ExceptionListener $exceptionListener = null, FirewallConfig $config = null) |
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.
to prevent any BC break, should getListeners() use iterator_to_array() then?
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.
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 care about laziness when getListeners is called? I think we don't. Right now, it's used only for debugging, where we don't care being lazy or not.
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.
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.
We do care, it's always used https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Http/Firewall.php#L61
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.
OK, I missed that. Then we should be clear about that in the CHANGELOG at least.
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.
CHANGELOG+UPGRADE entry added
3f97646
to
7e3aa5f
Compare
@@ -49,6 +49,12 @@ public function getContext() | |||
|
|||
public function getListeners() | |||
{ | |||
if (is_array($this->listeners)) { | |||
@trigger_error |
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.
to be removed :)
@@ -49,6 +49,12 @@ public function getContext() | |||
|
|||
public function getListeners() |
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.
lets add a return type hint here
UPGRADE-3.4.md
Outdated
SecurityBundle | ||
-------------- | ||
|
||
* `FirewallContext::getListeners()` now returns a `\Traversable` object by default instead of an |
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.
FirewallContext::getListeners()
now returns \Traversable|array
?
7e3aa5f
to
09d71e4
Compare
All fixed, typehints to be uncommented when merging into master |
cadac61
to
a2e5531
Compare
Build failure unrelated, seems like apcu ext is unavailable in travis builds. |
c3807c9
to
1ec82ed
Compare
1ec82ed
to
e3ee6bc
Compare
Thank you @chalasr. |
This PR was merged into the 3.4 branch. Discussion ---------- [SecurityBundle] Lazy load security listeners | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | yes | BC breaks? | yes (edge case) | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Each of them is heavy and unused if a previous one sets a response or breaks in the middle. Commits ------- e3ee6bc Lazy load security listeners
3.4.0 | ||
----- | ||
|
||
* [BC BREAK] `FirewallContext::getListeners()` now returns `\Traversable|array` |
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.
\Traversable|array
is iterable
Each of them is heavy and unused if a previous one sets a response or breaks in the middle.