@@ -83,9 +83,7 @@ protected function decrypt(Request $request)
8383 try {
8484 $ value = $ this ->decryptCookie ($ key , $ cookie );
8585
86- $ request ->cookies ->set (
87- $ key , $ this ->validateValue ($ key , $ value )
88- );
86+ $ request ->cookies ->set ($ key , $ this ->validateValue ($ key , $ value ));
8987 } catch (DecryptException $ e ) {
9088 $ request ->cookies ->set ($ key , null );
9189 }
@@ -103,8 +101,9 @@ protected function decrypt(Request $request)
103101 */
104102 protected function validateValue (string $ key , $ value )
105103 {
106- return is_array ($ value ) ? $ this ->validateArray ($ key , $ value ) :
107- CookieValuePrefix::validate ($ key , $ value , $ this ->encrypter ->getKey ());
104+ return is_array ($ value )
105+ ? $ this ->validateArray ($ key , $ value )
106+ : CookieValuePrefix::validate ($ key , $ value , $ this ->encrypter ->getKey ());
108107 }
109108
110109 /**
@@ -116,12 +115,13 @@ protected function validateValue(string $key, $value)
116115 */
117116 protected function validateArray (string $ key , array $ value )
118117 {
119- $ stripped = [];
120- foreach ($ value as $ subKey => $ subValue ) {
121- $ stripped [$ subKey ] = $ this ->validateValue ("$ {key}[ $ {subKey}] " , $ subValue );
118+ $ validated = [];
119+
120+ foreach ($ value as $ index => $ subValue ) {
121+ $ validated [$ index ] = $ this ->validateValue ("$ {key}[ $ {index}] " , $ subValue );
122122 }
123123
124- return $ stripped ;
124+ return $ validated ;
125125 }
126126
127127 /**
@@ -152,6 +152,7 @@ protected function decryptArray(array $cookie)
152152 if (is_string ($ value )) {
153153 $ decrypted [$ key ] = $ this ->encrypter ->decrypt ($ value , static ::serialized ($ key ));
154154 }
155+
155156 if (is_array ($ value )) {
156157 $ decrypted [$ key ] = $ this ->decryptArray ($ value );
157158 }
0 commit comments