minor #26566 [BrowserKit] Improves CookieJar::get (dunglas)
This PR was merged into the 2.7 branch.
Discussion
----------
[BrowserKit] Improves CookieJar::get
| Q | A
| ------------- | ---
| Branch? | master
| Bug fix? |no
| New feature? | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks? | no <!-- see https://symfony.com/bc -->
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass? | yes <!-- please add some, will be required by reviewers -->
| Fixed tickets | n/a
| License | MIT
| Doc PR | n/a
* change a call to `substr` + `strlen` to a single `strpos`
Commits
-------
57993143a9
[BrowserKit] Improves CookieJar::get
This commit is contained in:
commit
1390529b0f
@ -47,13 +47,13 @@ class CookieJar
|
|||||||
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
|
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
|
||||||
if ($cookieDomain) {
|
if ($cookieDomain) {
|
||||||
$cookieDomain = '.'.ltrim($cookieDomain, '.');
|
$cookieDomain = '.'.ltrim($cookieDomain, '.');
|
||||||
if ($cookieDomain != substr('.'.$domain, -strlen($cookieDomain))) {
|
if ($cookieDomain !== substr('.'.$domain, -\strlen($cookieDomain))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($pathCookies as $cookiePath => $namedCookies) {
|
foreach ($pathCookies as $cookiePath => $namedCookies) {
|
||||||
if ($cookiePath != substr($path, 0, strlen($cookiePath))) {
|
if (0 !== strpos($path, $cookiePath)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (isset($namedCookies[$name])) {
|
if (isset($namedCookies[$name])) {
|
||||||
|
Reference in New Issue
Block a user