You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+7-1Lines changed: 7 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -3,14 +3,20 @@
3
3
4
4
## Unreleased
5
5
6
-
## Fixed
6
+
### Added
7
+
8
+
- Cookie::createWithoutValidation Static constructor to create a cookie. Will not perform any attribute validation during instantiation.
9
+
- Cookie::isValid Method to check if cookie attributes are valid.
10
+
11
+
### Fixed
7
12
8
13
- FilteredStream::getSize returns null because the contents size is unknown.
9
14
10
15
### Deprecated
11
16
12
17
- FilteredStream::getReadFilter The read filter is internal and should never be used by consuming code.
13
18
- FilteredStream::getWriteFilter We did not implement writing to the streams at all. And if we do, the filter is an internal information and should not be used by consuming code.
19
+
- Attributes validation during Cookie instantiation is deprecated and will be removed in 2.0. Use the new `Cookie::isValid` to check if attributes are valid.
Copy file name to clipboardExpand all lines: src/Cookie.php
+53-6Lines changed: 53 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -53,6 +53,13 @@ final class Cookie
53
53
*/
54
54
private$expires;
55
55
56
+
/**
57
+
* Validation state.
58
+
*
59
+
* @var bool
60
+
*/
61
+
private$valid;
62
+
56
63
/**
57
64
* @param string $name
58
65
* @param string|null $value
@@ -61,9 +68,10 @@ final class Cookie
61
68
* @param string|null $path
62
69
* @param bool $secure
63
70
* @param bool $httpOnly
64
-
* @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided.
71
+
* @param \DateTime|null $expires Expires attribute is HTTP 1.0 only and should be avoided.
72
+
* @param bool $requireValidation deprecated since version 1.5. Will be removed in 2.0
65
73
*
66
-
* @throws \InvalidArgumentException If name, value or max age is not valid.
74
+
* @throws \InvalidArgumentException If name, value or max age is not valid. Attributes validation during instantiation is deprecated since 1.5 and will be removed in 2.0.
67
75
*/
68
76
publicfunction__construct(
69
77
$name,
@@ -73,11 +81,16 @@ public function __construct(
73
81
$path = null,
74
82
$secure = false,
75
83
$httpOnly = false,
76
-
\DateTime$expires = null
84
+
\DateTime$expires = null,
85
+
$requireValidation = true
77
86
) {
78
-
$this->validateName($name);
79
-
$this->validateValue($value);
80
-
$this->validateMaxAge($maxAge);
87
+
if ($requireValidation) {
88
+
@trigger_error('Attributes validation during instantiation is deprecated since 1.5 and will be removed in 2.0', E_USER_DEPRECATED);
0 commit comments