Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
071d8ab0
Commit
071d8ab0
authored
Jan 25, 2012
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move cookie payload check into cookie class.
parent
c847bc4d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
11 deletions
+12
-11
cookie.php
laravel/cookie.php
+12
-3
cookie.php
laravel/session/drivers/cookie.php
+0
-8
No files found.
laravel/cookie.php
View file @
071d8ab0
...
...
@@ -45,9 +45,9 @@ class Cookie {
// character for convenience. To separate the hash and the contents
// we can simply expode on that character.
//
// By re-feeding the cookie value into the "sign" method
,
we should
// be able to generate a hash that matches the one taken
out of
the
// cookie. If they don't
match
, the cookie value has been changed.
// By re-feeding the cookie value into the "sign" method we should
// be able to generate a hash that matches the one taken
from
the
// cookie. If they don't, the cookie value has been changed.
list
(
$hash
,
$value
)
=
explode
(
'~'
,
$value
,
2
);
if
(
static
::
hash
(
$name
,
$value
)
===
$hash
)
...
...
@@ -88,6 +88,15 @@ class Cookie {
$_COOKIE
[
$name
]
=
static
::
sign
(
$name
,
$value
);
// A cookie payload can't exceed 4096 bytes, so if the payload
// is greater than that, we'll raise an exception to warn the
// developer of the problem since it may cause problems with
// the application, especially if using cookie sessions.
if
(
strlen
(
$_COOKIE
[
$name
])
>
4000
)
{
throw
new
\Exception
(
"Payload too large for cookie."
);
}
return
setcookie
(
$name
,
$_COOKIE
[
$name
],
$time
,
$path
,
$domain
,
$secure
);
}
...
...
laravel/session/drivers/cookie.php
View file @
071d8ab0
...
...
@@ -41,14 +41,6 @@ class Cookie implements Driver {
$payload
=
Crypter
::
encrypt
(
serialize
(
$session
));
// A cookie payload can't exceed 4096 bytes, so if the encrypted payload
// is greater than that, we'll throw an exception so the developer can
// switch to another session driver for the application.
if
(
strlen
(
$payload
)
>
4000
)
{
throw
new
\Exception
(
"Session payload too large for cookie."
);
}
\Laravel\Cookie
::
put
(
Cookie
::
payload
,
$payload
,
$lifetime
,
$path
,
$domain
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment