Skip to content

Commit 6d4bb09

Browse files
committed
Fox Cookies
1 parent c877173 commit 6d4bb09

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

packages/session/src/Cookie/AbstractConfigurableCookies.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getOptions(): array
3939
$options = $this->propertiesToOptions();
4040

4141
if (isset($options['expires']) && $options['expires'] instanceof DateTimeInterface) {
42-
$options['expires'] = time() - $options['expires']->getTimestamp();
42+
$options['expires'] = time() + $options['expires']->getTimestamp();
4343
}
4444

4545
return $options;

packages/session/src/Cookie/Cookies.php

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,16 +15,16 @@ public static function create(): static
1515
}
1616

1717
/**
18-
* @param string $name
19-
* @param string $value
18+
* @param string $name
19+
* @param string $value
2020
* @param ?array{
2121
* expires?: int,
2222
* path?: string,
2323
* domain?: string,
2424
* secure?: bool,
2525
* httponly?: bool,
2626
* samesite?: "Lax"|"Strict"|"None"
27-
* } $options
27+
* } $options
2828
*
2929
* @return bool
3030
*/
@@ -34,7 +34,14 @@ public function set(string $name, string $value, ?array $options = null): bool
3434
return false;
3535
}
3636

37-
return setcookie($name, $value, $options ?? $this->getOptions());
37+
return setcookie(
38+
$name,
39+
$value,
40+
[
41+
...$this->getOptions(),
42+
...($options ?? []),
43+
]
44+
);
3845
}
3946

4047
public function get(string $name): ?string

0 commit comments

Comments
 (0)