Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
UserAdminV2
Overview
Overview
Details
Activity
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
庄欣
UserAdminV2
Commits
429c9cee
Commit
429c9cee
authored
Aug 26, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix session related bugs.
parent
d65ddb53
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
34 additions
and
24 deletions
+34
-24
laravel/config/container.php
+1
-1
laravel/laravel.php
+17
-14
laravel/session/cookie.php
+3
-3
laravel/session/driver.php
+11
-5
laravel/session/manager.php
+2
-1
No files found.
laravel/config/container.php
View file @
429c9cee
...
@@ -77,7 +77,7 @@ return array(
...
@@ -77,7 +77,7 @@ return array(
'laravel.session.cookie'
=>
array
(
'resolver'
=>
function
(
$container
)
'laravel.session.cookie'
=>
array
(
'resolver'
=>
function
(
$container
)
{
{
return
new
Session\Cookie
(
new
Crypter
,
$container
->
resolve
(
'laravel.request'
)
->
input
->
cookies
);
return
new
Session\Cookie
(
Security\Crypter
::
make
()
,
$container
->
resolve
(
'laravel.request'
)
->
input
->
cookies
);
}),
}),
/*
/*
...
...
laravel/laravel.php
View file @
429c9cee
...
@@ -114,9 +114,24 @@ require SYS_PATH.'routing/router'.EXT;
...
@@ -114,9 +114,24 @@ require SYS_PATH.'routing/router'.EXT;
require
SYS_PATH
.
'routing/handler'
.
EXT
;
require
SYS_PATH
.
'routing/handler'
.
EXT
;
// --------------------------------------------------------------
// --------------------------------------------------------------
// Initialize the request instance for the request.
// --------------------------------------------------------------
$request
=
new
Request
(
$_SERVER
);
IoC
::
container
()
->
instance
(
'laravel.request'
,
$request
);
// --------------------------------------------------------------
// Hydrate the input for the current request.
// --------------------------------------------------------------
$request
->
input
=
new
Input
(
$request
->
method
(),
$request
->
is_spoofed
(),
$_GET
,
$_POST
,
$_FILES
,
new
Cookie
(
$_COOKIE
));
// --------------------------------------------------------------
// Load the session.
// Load the session.
// --------------------------------------------------------------
// --------------------------------------------------------------
if
(
Config
::
get
(
'session.driver'
)
!=
''
)
Session\Manager
::
driver
()
->
start
(
Cookie
::
get
(
'laravel_session'
));
if
(
Config
::
get
(
'session.driver'
)
!=
''
)
{
Session\Manager
::
driver
()
->
start
(
$request
->
input
->
cookies
->
get
(
'laravel_session'
));
}
// --------------------------------------------------------------
// --------------------------------------------------------------
// Load the packages that are in the auto-loaded packages array.
// Load the packages that are in the auto-loaded packages array.
...
@@ -129,18 +144,6 @@ if (count(Config::get('application.packages')) > 0)
...
@@ -129,18 +144,6 @@ if (count(Config::get('application.packages')) > 0)
}
}
// --------------------------------------------------------------
// --------------------------------------------------------------
// Initialize the request instance for the request.
// --------------------------------------------------------------
$request
=
new
Request
(
$_SERVER
);
IoC
::
container
()
->
instance
(
'laravel.request'
,
$request
);
// --------------------------------------------------------------
// Hydrate the input for the current request.
// --------------------------------------------------------------
$request
->
input
=
new
Input
(
$request
->
method
(),
$request
->
is_spoofed
(),
$_GET
,
$_POST
,
$_FILES
,
new
Cookie
(
$_COOKIE
));
// --------------------------------------------------------------
// Route the request and get the response from the route.
// Route the request and get the response from the route.
// --------------------------------------------------------------
// --------------------------------------------------------------
$route
=
IoC
::
container
()
->
resolve
(
'laravel.routing.router'
)
->
route
();
$route
=
IoC
::
container
()
->
resolve
(
'laravel.routing.router'
)
->
route
();
...
@@ -161,7 +164,7 @@ if (Config::get('session.driver') != '')
...
@@ -161,7 +164,7 @@ if (Config::get('session.driver') != '')
$driver
->
flash
(
'laravel_old_input'
,
$request
->
input
->
get
());
$driver
->
flash
(
'laravel_old_input'
,
$request
->
input
->
get
());
$driver
->
close
();
$driver
->
close
(
$request
->
input
->
cookies
);
if
(
$driver
instanceof
Session\Sweeper
and
mt_rand
(
1
,
100
)
<=
2
)
if
(
$driver
instanceof
Session\Sweeper
and
mt_rand
(
1
,
100
)
<=
2
)
{
{
...
...
laravel/session/cookie.php
View file @
429c9cee
...
@@ -22,11 +22,11 @@ class Cookie extends Driver {
...
@@ -22,11 +22,11 @@ class Cookie extends Driver {
/**
/**
* Create a new Cookie session driver instance.
* Create a new Cookie session driver instance.
*
*
* @param Crypter $crypter
* @param Crypter
$crypter
* @param
Cookie
$cookie
* @param
Laravel\Cookie
$cookie
* @return void
* @return void
*/
*/
public
function
__construct
(
Crypter
$crypter
,
Cookie
$cookie
)
public
function
__construct
(
Crypter
$crypter
,
\Laravel\
Cookie
$cookie
)
{
{
$this
->
cookie
=
$cookie
;
$this
->
cookie
=
$cookie
;
$this
->
crypter
=
$crypter
;
$this
->
crypter
=
$crypter
;
...
...
laravel/session/driver.php
View file @
429c9cee
...
@@ -188,15 +188,16 @@ abstract class Driver {
...
@@ -188,15 +188,16 @@ abstract class Driver {
* The session will be stored in persistant storage and the session cookie will be
* The session will be stored in persistant storage and the session cookie will be
* session cookie will be sent to the browser.
* session cookie will be sent to the browser.
*
*
* @param Laravel\Cookie $cookie
* @return void
* @return void
*/
*/
public
function
close
()
public
function
close
(
\Laravel\Cookie
$cookie
)
{
{
$this
->
age_flash
();
$this
->
age_flash
();
$this
->
save
();
$this
->
save
();
$this
->
write_cookie
();
$this
->
write_cookie
(
$cookie
);
}
}
/**
/**
...
@@ -225,15 +226,20 @@ abstract class Driver {
...
@@ -225,15 +226,20 @@ abstract class Driver {
/**
/**
* Write the session cookie.
* Write the session cookie.
*
*
* @param Laravel\Cookie $cookie
* @return void
* @return void
*/
*/
protected
function
write_cookie
()
protected
function
write_cookie
(
\Laravel\Cookie
$cookie
)
{
{
if
(
!
headers_sent
())
if
(
!
headers_sent
())
{
{
$
minutes
=
(
Config
::
get
(
'session.expire_on_close'
))
?
0
:
Config
::
get
(
'session.lifetime
'
);
$
config
=
Config
::
get
(
'session
'
);
Cookie
::
put
(
'laravel_session'
,
static
::
$session
[
'id'
],
$minutes
,
Config
::
get
(
'session.path'
),
Config
::
get
(
'session.domain'
),
Config
::
get
(
'session.https'
),
Config
::
get
(
'http_only'
));
extract
(
$config
);
$minutes
=
(
$expire_on_close
)
?
0
:
$lifetime
;
$cookie
->
put
(
'laravel_session'
,
$this
->
session
[
'id'
],
$minutes
,
$path
,
$domain
,
$https
,
$http_only
);
}
}
}
}
...
...
laravel/session/manager.php
View file @
429c9cee
<?php
namespace
Laravel\Session
;
<?php
namespace
Laravel\Session
;
use
Laravel\IoC
;
use
Laravel\Config
;
use
Laravel\Config
;
class
Manager
{
class
Manager
{
...
@@ -26,7 +27,7 @@ class Manager {
...
@@ -26,7 +27,7 @@ class Manager {
{
{
$driver
=
Config
::
get
(
'session.driver'
);
$driver
=
Config
::
get
(
'session.driver'
);
if
(
in_array
(
$driver
,
array
(
'cookie'
,
'file'
,
'database'
,
'memcached'
)))
if
(
in_array
(
$driver
,
array
(
'cookie'
,
'file'
,
'database'
,
'
apc'
,
'
memcached'
)))
{
{
return
static
::
$driver
=
IoC
::
container
()
->
resolve
(
'laravel.session.'
.
$driver
);
return
static
::
$driver
=
IoC
::
container
()
->
resolve
(
'laravel.session.'
.
$driver
);
}
}
...
...
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