1
0
mirror of https://github.com/guzzle/guzzle.git synced 2025-01-17 21:38:16 +01:00

Merge branch '7.5' into 7.6

This commit is contained in:
Graham Campbell 2023-05-15 22:43:01 +02:00
commit 8444a2bacf
No known key found for this signature in database
GPG Key ID: C3CF350727B24FEC
3 changed files with 45 additions and 3 deletions

View File

@ -2,6 +2,12 @@
Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version. Please refer to [UPGRADING](UPGRADING.md) guide for upgrading to a major version.
## 7.6.1 - 2023-05-15
### Fixed
- Fix `SetCookie::fromString` MaxAge deprecation warning and skip invalid MaxAge values
## 7.6.0 - 2023-05-14 ## 7.6.0 - 2023-05-14
### Added ### Added

View File

@ -58,7 +58,13 @@ class SetCookie
} else { } else {
foreach (\array_keys(self::$defaults) as $search) { foreach (\array_keys(self::$defaults) as $search) {
if (!\strcasecmp($search, $key)) { if (!\strcasecmp($search, $key)) {
$data[$search] = $value; if ($search === 'Max-Age') {
if (is_numeric($value)) {
$data[$search] = (int) $value;
}
} else {
$data[$search] = $value;
}
continue 2; continue 2;
} }
} }

View File

@ -367,14 +367,44 @@ class SetCookieTest extends TestCase
'Value' => 'synced', 'Value' => 'synced',
'Domain' => '.example.com', 'Domain' => '.example.com',
'Path' => '/', 'Path' => '/',
'Expires' => \time() + 604800, 'Expires' => null,
'Secure' => true, 'Secure' => true,
'Discard' => false, 'Discard' => false,
'Max-Age' => 604800, 'Max-Age' => null,
'HttpOnly' => true, 'HttpOnly' => true,
'SameSite' => 'None', 'SameSite' => 'None',
], ],
], ],
[
'SESS3a6f27284c4d8b34b6f4ff98cb87703e=Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH; expires=Wed, 07-Jun-2023 15:56:35 GMT; Max-Age=2000000; path=/; domain=.example.com; HttpOnly; SameSite=Lax',
[
'Name' => 'SESS3a6f27284c4d8b34b6f4ff98cb87703e',
'Value' => 'Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH',
'Domain' => '.example.com',
'Path' => '/',
'Expires' => 'Wed, 07-Jun-2023 15:56:35 GMT',
'Secure' => false,
'Discard' => false,
'Max-Age' => 2000000,
'HttpOnly' => true,
'SameSite' => 'Lax',
],
],
[
'SESS3a6f27284c4d8b34b6f4ff98cb87703e=Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH; expires=Wed, 07-Jun-2023 15:56:35 GMT; Max-Age=qwerty; path=/; domain=.example.com; HttpOnly; SameSite=Lax',
[
'Name' => 'SESS3a6f27284c4d8b34b6f4ff98cb87703e',
'Value' => 'Ts-5YeSyvOCMS%2CzkEb9eDfW4C4ZNFOcRYdu-3JpEAXIm58aH',
'Domain' => '.example.com',
'Path' => '/',
'Expires' => 'Wed, 07-Jun-2023 15:56:35 GMT',
'Secure' => false,
'Discard' => false,
'Max-Age' => null,
'HttpOnly' => true,
'SameSite' => 'Lax',
],
],
]; ];
} }