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
if (preg_match(self::PATTERN_TOKEN, $name) !== 1) {
129
129
thrownew \InvalidArgumentException('The parameter "name" passed to the Cookie constructor must be a valid token as per RFC 2616, Section 2.2.', 1345101977);
130
130
}
131
131
if ($expiresinstanceof \DateTimeInterface) {
132
132
$expires = $expires->getTimestamp();
133
133
}
134
-
if ($maximumAge !== null) {
134
+
if (!is_int($expires)) {
135
+
thrownew \InvalidArgumentException('The parameter "expires" passed to the Cookie constructor must be a unix timestamp or a DateTimeInterface object.', 1345108785);
136
+
}
137
+
/** @phpstan-ignore booleanAnd.alwaysFalse (until $maximumAge is typed ?int in php) */
138
+
if ($maximumAge !== null && !is_int($maximumAge)) {
135
139
thrownew \InvalidArgumentException('The parameter "maximumAge" passed to the Cookie constructor must be an integer value.', 1345108786);
136
140
}
137
141
if ($domain !== null && preg_match(self::PATTERN_DOMAIN, $domain) !== 1) {
138
142
thrownew \InvalidArgumentException('The parameter "domain" passed to the Cookie constructor must be a valid domain as per RFC 6265, Section 4.1.2.3.', 1345116246);
139
143
}
140
-
if (preg_match(self::PATTERN_PATH, $path) !== 1) {
144
+
if ($path !== null && preg_match(self::PATTERN_PATH, $path) !== 1) {
141
145
thrownew \InvalidArgumentException('The parameter "path" passed to the Cookie constructor must be a valid path as per RFC 6265, Section 4.1.1.', 1345123078);
0 commit comments