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: RememberMe/RememberMeDetails.php
+75-14Lines changed: 75 additions & 14 deletions
Original file line number
Diff line number
Diff line change
@@ -21,34 +21,95 @@ class RememberMeDetails
21
21
{
22
22
publicconstCOOKIE_DELIMITER = ':';
23
23
24
+
private ?string$userFqcn = null;
25
+
privatestring$userIdentifier;
26
+
privateint$expires;
27
+
privatestring$value;
28
+
29
+
/**
30
+
* @param string $userIdentifier
31
+
* @param int $expires
32
+
* @param string $value
33
+
*/
24
34
publicfunction__construct(
25
-
privatestring$userFqcn,
26
-
privatestring$userIdentifier,
27
-
privateint$expires,
28
-
privatestring$value,
35
+
$userIdentifier,
36
+
$expires,
37
+
$value,
29
38
) {
39
+
if (\func_num_args() > 3) {
40
+
if (\func_num_args() < 5 || func_get_arg(4)) {
41
+
trigger_deprecation('symfony/security-http', '7.4', 'Passing a user FQCN to %s() is deprecated. The user class will be removed from the remember-me cookie in 8.0.', __CLASS__, __NAMESPACE__);
42
+
}
43
+
44
+
if (!\is_string($userIdentifier)) {
45
+
thrownew \TypeError(\sprintf('Argument 1 passed to "%s()" must be a string, "%s" given.', __METHOD__, get_debug_type($userIdentifier)));
46
+
}
47
+
48
+
$this->userFqcn = $userIdentifier;
49
+
$userIdentifier = $expires;
50
+
$expires = $value;
51
+
52
+
if (\func_num_args() <= 3) {
53
+
thrownew \TypeError(\sprintf('Argument 4 passed to "%s()" must be a string, the argument is missing.', __METHOD__));
54
+
}
55
+
56
+
$value = func_get_arg(3);
57
+
}
58
+
59
+
if (!\is_string($userIdentifier)) {
60
+
thrownew \TypeError(\sprintf('The $userIdentifier argument passed to "%s()" must be a string, "%s" given.', __METHOD__, get_debug_type($userIdentifier)));
61
+
}
62
+
63
+
if (!\is_int($expires) && !preg_match('/^\d+$/', $expires)) {
64
+
thrownew \TypeError(\sprintf('$The $expires argument passed to "%s()" must be an integer, "%s" given.', __METHOD__, get_debug_type($expires)));
65
+
}
66
+
67
+
if (!\is_string($value)) {
68
+
thrownew \TypeError(\sprintf('The $value argument passed to "%s()" must be a string, "%s" given.', __METHOD__, get_debug_type($value)));
@@ -66,7 +127,7 @@ public function getUserFqcn(): string
66
127
{
67
128
trigger_deprecation('symfony/security-http', '7.4', 'The "%s()" method is deprecated: the user FQCN will be removed from the remember-me cookie in 8.0.', __METHOD__);
68
129
69
-
return$this->userFqcn;
130
+
return$this->userFqcn ?? '';
70
131
}
71
132
72
133
publicfunctiongetUserIdentifier(): string
@@ -87,6 +148,6 @@ public function getValue(): string
87
148
publicfunctiontoString(): string
88
149
{
89
150
// $userIdentifier is encoded because it might contain COOKIE_DELIMITER, we assume other values don't
0 commit comments