Skip to content

Commit e8487e5

Browse files
committed
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
2 parents 60d5cbd + 1cc92d4 commit e8487e5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

CookieJar.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ public function get($name, $path = '/', $domain = null)
4747
foreach ($this->cookieJar as $cookieDomain => $pathCookies) {
4848
if ($cookieDomain) {
4949
$cookieDomain = '.'.ltrim($cookieDomain, '.');
50-
if ($cookieDomain != substr('.'.$domain, -strlen($cookieDomain))) {
50+
if ($cookieDomain !== substr('.'.$domain, -\strlen($cookieDomain))) {
5151
continue;
5252
}
5353
}
5454

5555
foreach ($pathCookies as $cookiePath => $namedCookies) {
56-
if ($cookiePath != substr($path, 0, strlen($cookiePath))) {
56+
if (0 !== strpos($path, $cookiePath)) {
5757
continue;
5858
}
5959
if (isset($namedCookies[$name])) {

0 commit comments

Comments
 (0)