Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
PSDI Army
yii2
Commits
03db4c46
Commit
03db4c46
authored
Mar 30, 2014
by
Qiang Xue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes #2921
parent
4acab5c4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
14 deletions
+8
-14
Session.php
framework/web/Session.php
+8
-14
No files found.
framework/web/Session.php
View file @
03db4c46
...
...
@@ -84,10 +84,10 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
public
$handler
;
/**
* @var array parameter-value pairs to override default session cookie parameters that are used for session_set_cookie_params() function
* Array may have the following possible keys: 'lifetime', 'path', 'domain', 'secure', 'http
O
nly'
* Array may have the following possible keys: 'lifetime', 'path', 'domain', 'secure', 'http
o
nly'
* @see http://www.php.net/manual/en/function.session-set-cookie-params.php
*/
private
$_cookieParams
=
[
'http
O
nly'
=>
true
];
private
$_cookieParams
=
[
'http
o
nly'
=>
true
];
/**
* Initializes the application component.
...
...
@@ -301,26 +301,20 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
*/
public
function
getCookieParams
()
{
$params
=
session_get_cookie_params
();
if
(
isset
(
$params
[
'httponly'
]))
{
$params
[
'httpOnly'
]
=
$params
[
'httponly'
];
unset
(
$params
[
'httponly'
]);
}
return
array_merge
(
$params
,
$this
->
_cookieParams
);
return
array_merge
(
session_get_cookie_params
(),
$this
->
_cookieParams
);
}
/**
* Sets the session cookie parameters.
* The cookie parameters passed to this method will be merged with the result
* of `session_get_cookie_params()`.
* @param array $value cookie parameters, valid keys include: `lifetime`, `path`, `domain`, `secure` and `http
O
nly`.
* @param array $value cookie parameters, valid keys include: `lifetime`, `path`, `domain`, `secure` and `http
o
nly`.
* @throws InvalidParamException if the parameters are incomplete.
* @see http://us2.php.net/manual/en/function.session-set-cookie-params.php
*/
public
function
setCookieParams
(
array
$value
)
{
$this
->
_cookieParams
=
$value
;
$this
->
_cookieParams
=
array_change_key_case
(
$value
)
;
}
/**
...
...
@@ -333,10 +327,10 @@ class Session extends Component implements \IteratorAggregate, \ArrayAccess, \Co
{
$data
=
$this
->
getCookieParams
();
extract
(
$data
);
if
(
isset
(
$lifetime
,
$path
,
$domain
,
$secure
,
$http
O
nly
))
{
session_set_cookie_params
(
$lifetime
,
$path
,
$domain
,
$secure
,
$http
O
nly
);
if
(
isset
(
$lifetime
,
$path
,
$domain
,
$secure
,
$http
o
nly
))
{
session_set_cookie_params
(
$lifetime
,
$path
,
$domain
,
$secure
,
$http
o
nly
);
}
else
{
throw
new
InvalidParamException
(
'Please make sure cookieParams contains these elements: lifetime, path, domain, secure and http
O
nly.'
);
throw
new
InvalidParamException
(
'Please make sure cookieParams contains these elements: lifetime, path, domain, secure and http
o
nly.'
);
}
}
...
...
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