-
Notifications
You must be signed in to change notification settings - Fork 283
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
Unable to create cookies with session=false #675
Comments
Turns out you can't directly set session=false, but session will be set to false if the cookie has an expiration date, meaning if the code is changed to $page->setCookies([
\HeadlessChromium\Cookies\Cookie::create("session_false", "session_false", ["expires" => PHP_INT_MAX, "domain" => "example.com"]),
\HeadlessChromium\Cookies\Cookie::create("session_true", "session_true", ["session" => true, "domain" => "example.com"]),
])->await(); it will print the expected string(13) "session_false"
bool(false)
string(12) "session_true"
bool(true) 🤔 not a chrome-php bug at least, this is how the DevTools protocol is designed. We could make a convenience wrapper tho |
divinity76
added a commit
to divinity76/chrome
that referenced
this issue
Jan 7, 2025
Previously ```php $page->setCookies([ \HeadlessChromium\Cookies\Cookie::create("session_false", "session_false", ["session" => false, "domain" => "example.com"]), \HeadlessChromium\Cookies\Cookie::create("session_true", "session_true", ["session" => true, "domain" => "example.com"]), ])->await(); ``` would create 2 cookies with session=true, but now it will create 1 cookie with session=false and 1 with session=true close chrome-phpGH-675
Will be supported in 1.13. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following code:
produce this output:
but I expected this output instead:
The text was updated successfully, but these errors were encountered: