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
69abbc7f
Commit
69abbc7f
authored
Jun 28, 2014
by
Paul Klimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fallback at `Security::generateRandomKey()` removed
parent
052ae833
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
Security.php
framework/base/Security.php
+2
-6
No files found.
framework/base/Security.php
View file @
69abbc7f
...
...
@@ -180,7 +180,7 @@ class Security extends Component
$end
=
StringHelper
::
byteSubstr
(
$data
,
-
1
,
null
);
$last
=
ord
(
$end
);
$n
=
StringHelper
::
byteLength
(
$data
)
-
$last
;
if
(
StringHelper
::
byteSubstr
(
$data
,
$n
,
null
)
==
str_repeat
(
$end
,
$last
))
{
if
(
StringHelper
::
byteSubstr
(
$data
,
$n
,
null
)
==
=
str_repeat
(
$end
,
$last
))
{
return
StringHelper
::
byteSubstr
(
$data
,
0
,
$n
);
}
...
...
@@ -322,11 +322,7 @@ class Security extends Component
*/
public
function
generateRandomKey
(
$length
=
32
)
{
if
(
function_exists
(
'mcrypt_create_iv'
))
{
return
mcrypt_create_iv
(
$length
,
MCRYPT_DEV_URANDOM
);
}
$chars
=
'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-.'
;
return
substr
(
str_shuffle
(
str_repeat
(
$chars
,
5
)),
0
,
$length
);
return
mcrypt_create_iv
(
$length
,
MCRYPT_DEV_URANDOM
);
}
/**
...
...
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