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
b4862190
Commit
b4862190
authored
Nov 16, 2012
by
NetPuter
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `mb_substr` instead of `sub_str` in order to resolve multi-language problem.
parent
d2fefa65
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
3 deletions
+15
-3
crypter.php
laravel/crypter.php
+15
-3
No files found.
laravel/crypter.php
View file @
b4862190
...
@@ -129,7 +129,14 @@ class Crypter {
...
@@ -129,7 +129,14 @@ class Crypter {
*/
*/
protected
static
function
unpad
(
$value
)
protected
static
function
unpad
(
$value
)
{
{
$pad
=
ord
(
$value
[(
$length
=
Str
::
length
(
$value
))
-
1
]);
if
(
MB_STRING
)
{
$pad
=
ord
(
mb_substr
(
$value
,
-
1
,
1
,
Config
::
get
(
'application.encoding'
)));
}
else
{
$pad
=
ord
(
substr
(
$value
,
-
1
));
}
if
(
$pad
and
$pad
<
static
::
$block
)
if
(
$pad
and
$pad
<
static
::
$block
)
{
{
...
@@ -138,7 +145,12 @@ class Crypter {
...
@@ -138,7 +145,12 @@ class Crypter {
// as the padding appears to have been changed.
// as the padding appears to have been changed.
if
(
preg_match
(
'/'
.
chr
(
$pad
)
.
'{'
.
$pad
.
'}$/'
,
$value
))
if
(
preg_match
(
'/'
.
chr
(
$pad
)
.
'{'
.
$pad
.
'}$/'
,
$value
))
{
{
return
substr
(
$value
,
0
,
$length
-
$pad
);
if
(
MB_STRING
)
{
return
mb_substr
(
$value
,
0
,
Str
::
length
(
$value
)
-
$pad
,
Config
::
get
(
'application.encoding'
));
}
return
substr
(
$value
,
0
,
Str
::
length
(
$value
)
-
$pad
);
}
}
// If the padding characters do not match the expected padding
// If the padding characters do not match the expected padding
...
@@ -163,4 +175,4 @@ class Crypter {
...
@@ -163,4 +175,4 @@ class Crypter {
return
Config
::
get
(
'application.key'
);
return
Config
::
get
(
'application.key'
);
}
}
}
}
\ No newline at end of file
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