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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
100ba6c3
Commit
100ba6c3
authored
Jul 30, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replaced substr_compare with strncmp where possible
parent
3a1e0f3a
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
16 deletions
+14
-16
PhpDocController.php
build/controllers/PhpDocController.php
+8
-10
OpenId.php
extensions/authclient/OpenId.php
+3
-3
MessageController.php
framework/console/controllers/MessageController.php
+1
-1
GettextMoFile.php
framework/i18n/GettextMoFile.php
+1
-1
MessageFormatter.php
framework/i18n/MessageFormatter.php
+1
-1
No files found.
build/controllers/PhpDocController.php
View file @
100ba6c3
...
...
@@ -176,7 +176,7 @@ class PhpDocController extends Controller
foreach
(
$lines
as
$i
=>
$line
)
{
$line
=
trim
(
$line
);
if
(
!
empty
(
$line
))
{
if
(
s
ubstr_compare
(
$line
,
'namespace'
,
0
,
9
)
===
0
)
{
if
(
s
trncmp
(
$line
,
'namespace'
,
9
)
===
0
)
{
$namespace
=
$i
;
$namespaceLine
=
$line
;
}
elseif
(
$namespace
!==
false
)
{
...
...
@@ -392,17 +392,15 @@ class PhpDocController extends Controller
// TODO move these checks to different action
$lines
=
explode
(
"
\n
"
,
$newDoc
);
$firstLine
=
trim
(
$lines
[
1
]);
if
(
$firstLine
===
'*'
||
(
!
empty
(
$firstLine
)
&&
substr_compare
(
$firstLine
,
'* @'
,
0
,
3
)
===
0
)
)
{
if
(
$firstLine
===
'*'
||
strncmp
(
$firstLine
,
'* @'
,
3
)
===
0
)
{
$this
->
stderr
(
"[WARN] Class
$className
has no short description.
\n
"
,
Console
::
FG_YELLOW
,
Console
::
BOLD
);
}
foreach
(
$lines
as
$line
)
{
$line
=
trim
(
$line
);
if
(
!
empty
(
$line
))
{
if
(
substr_compare
(
$line
,
'* @since '
,
0
,
9
)
===
0
)
{
$seenSince
=
true
;
}
elseif
(
substr_compare
(
$line
,
'* @author '
,
0
,
10
)
===
0
)
{
$seenAuthor
=
true
;
}
if
(
strncmp
(
$line
,
'* @since '
,
9
)
===
0
)
{
$seenSince
=
true
;
}
elseif
(
strncmp
(
$line
,
'* @author '
,
10
)
===
0
)
{
$seenAuthor
=
true
;
}
}
...
...
@@ -471,13 +469,13 @@ class PhpDocController extends Controller
$propertyPosition
=
false
;
foreach
(
$lines
as
$i
=>
$line
)
{
$line
=
trim
(
$line
);
if
(
!
empty
(
$line
)
&&
substr_compare
(
$line
,
'* @property '
,
0
,
12
)
===
0
)
{
if
(
strncmp
(
$line
,
'* @property '
,
12
)
===
0
)
{
$propertyPart
=
true
;
}
elseif
(
$propertyPart
&&
$line
==
'*'
)
{
$propertyPosition
=
$i
;
$propertyPart
=
false
;
}
if
(
!
empty
(
$line
)
&&
substr_compare
(
$line
,
'* @author '
,
0
,
10
)
===
0
&&
$propertyPosition
===
false
)
{
if
(
strncmp
(
$line
,
'* @author '
,
10
)
===
0
&&
$propertyPosition
===
false
)
{
$propertyPosition
=
$i
-
1
;
$propertyPart
=
false
;
}
...
...
extensions/authclient/OpenId.php
View file @
100ba6c3
...
...
@@ -761,7 +761,7 @@ class OpenId extends BaseClient implements ClientInterface
}
else
{
// 'ax' prefix is either undefined, or points to another extension, so we search for another prefix
foreach
(
$this
->
data
as
$key
=>
$value
)
{
if
(
s
ubstr_compare
(
$key
,
'openid_ns_'
,
0
,
10
)
===
0
&&
$value
==
'http://openid.net/srv/ax/1.0'
)
{
if
(
s
trncmp
(
$key
,
'openid_ns_'
,
10
)
===
0
&&
$value
==
'http://openid.net/srv/ax/1.0'
)
{
$alias
=
substr
(
$key
,
strlen
(
'openid_ns_'
));
break
;
}
...
...
@@ -775,7 +775,7 @@ class OpenId extends BaseClient implements ClientInterface
$attributes
=
[];
foreach
(
$this
->
data
as
$key
=>
$value
)
{
$keyMatch
=
'openid_'
.
$alias
.
'_value_'
;
if
(
s
ubstr_compare
(
$key
,
$keyMatch
,
0
,
strlen
(
$keyMatch
)))
{
if
(
s
trncmp
(
$key
,
$keyMatch
,
strlen
(
$keyMatch
)))
{
continue
;
}
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
...
...
@@ -802,7 +802,7 @@ class OpenId extends BaseClient implements ClientInterface
$sregToAx
=
array_flip
(
$this
->
axToSregMap
);
foreach
(
$this
->
data
as
$key
=>
$value
)
{
$keyMatch
=
'openid_sreg_'
;
if
(
s
ubstr_compare
(
$key
,
$keyMatch
,
0
,
strlen
(
$keyMatch
)))
{
if
(
s
trncmp
(
$key
,
$keyMatch
,
strlen
(
$keyMatch
)))
{
continue
;
}
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
...
...
framework/console/controllers/MessageController.php
View file @
100ba6c3
...
...
@@ -332,7 +332,7 @@ class MessageController extends Controller
ksort
(
$existingMessages
);
foreach
(
$existingMessages
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
if
(
!
empty
(
$translation
)
&&
s
ubstr_compare
(
$translation
,
'@@'
,
0
,
2
)
===
0
&&
substr_compare
(
$translation
,
'@@'
,
-
2
)
===
0
)
{
if
(
!
empty
(
$translation
)
&&
s
trncmp
(
$translation
,
'@@'
,
2
)
===
0
&&
substr_compare
(
$translation
,
'@@'
,
-
2
)
===
0
)
{
$todo
[
$message
]
=
$translation
;
}
else
{
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
...
...
framework/i18n/GettextMoFile.php
View file @
100ba6c3
...
...
@@ -109,7 +109,7 @@ class GettextMoFile extends GettextFile
$separatorPosition
=
strpos
(
$id
,
chr
(
4
));
if
((
$context
&&
$separatorPosition
!==
false
&&
!
empty
(
$id
)
&&
substr_compare
(
$id
,
$context
,
0
,
$separatorPosition
)
===
0
)
||
if
((
$context
&&
$separatorPosition
!==
false
&&
strncmp
(
$id
,
$context
,
$separatorPosition
)
===
0
)
||
(
!
$context
&&
$separatorPosition
===
false
))
{
if
(
$separatorPosition
!==
false
)
{
$id
=
substr
(
$id
,
$separatorPosition
+
1
);
...
...
framework/i18n/MessageFormatter.php
View file @
100ba6c3
...
...
@@ -392,7 +392,7 @@ class MessageFormatter extends Component
}
$selector
=
trim
(
$plural
[
$i
++
]);
if
(
$i
==
1
&&
!
empty
(
$selector
)
&&
substr_compare
(
$selector
,
'offset:'
,
0
,
7
)
===
0
)
{
if
(
$i
==
1
&&
strncmp
(
$selector
,
'offset:'
,
7
)
===
0
)
{
$offset
=
(
int
)
trim
(
mb_substr
(
$selector
,
7
,
(
$pos
=
mb_strpos
(
str_replace
([
"
\n
"
,
"
\r
"
,
"
\t
"
],
' '
,
$selector
),
' '
,
7
))
-
7
));
$selector
=
trim
(
mb_substr
(
$selector
,
$pos
+
1
));
}
...
...
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