Skip to content

Commit 38dd005

Browse files
Joris van EijdenDavertMik
authored andcommitted
Avoid removing required fields in cookies. (#5470)
1 parent 8563a98 commit 38dd005

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Codeception/Module/WebDriver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,13 +825,17 @@ public function setCookie($cookie, $value, array $params = [])
825825
}
826826
}
827827
// #5401 Supply defaults, otherwise chromedriver 2.46 complains.
828-
$params = array_filter($params);
829-
$params += [
828+
$defaults = [
830829
'path' => '/',
831830
'expiry' => time() + 86400,
832831
'secure' => false,
833832
'httpOnly' => false,
834833
];
834+
foreach ($defaults as $key => $default) {
835+
if (empty($params[$key])) {
836+
$params[$key] = $default;
837+
}
838+
}
835839
$this->webDriver->manage()->addCookie($params);
836840
$this->debugSection('Cookies', json_encode($this->webDriver->manage()->getCookies()));
837841
}

0 commit comments

Comments
 (0)