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
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
...
@@ -176,7 +176,7 @@ class PhpDocController extends Controller
foreach
(
$lines
as
$i
=>
$line
)
{
foreach
(
$lines
as
$i
=>
$line
)
{
$line
=
trim
(
$line
);
$line
=
trim
(
$line
);
if
(
!
empty
(
$line
))
{
if
(
!
empty
(
$line
))
{
if
(
s
ubstr_compare
(
$line
,
'namespace'
,
0
,
9
)
===
0
)
{
if
(
s
trncmp
(
$line
,
'namespace'
,
9
)
===
0
)
{
$namespace
=
$i
;
$namespace
=
$i
;
$namespaceLine
=
$line
;
$namespaceLine
=
$line
;
}
elseif
(
$namespace
!==
false
)
{
}
elseif
(
$namespace
!==
false
)
{
...
@@ -392,17 +392,15 @@ class PhpDocController extends Controller
...
@@ -392,17 +392,15 @@ class PhpDocController extends Controller
// TODO move these checks to different action
// TODO move these checks to different action
$lines
=
explode
(
"
\n
"
,
$newDoc
);
$lines
=
explode
(
"
\n
"
,
$newDoc
);
$firstLine
=
trim
(
$lines
[
1
]);
$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
);
$this
->
stderr
(
"[WARN] Class
$className
has no short description.
\n
"
,
Console
::
FG_YELLOW
,
Console
::
BOLD
);
}
}
foreach
(
$lines
as
$line
)
{
foreach
(
$lines
as
$line
)
{
$line
=
trim
(
$line
);
$line
=
trim
(
$line
);
if
(
!
empty
(
$line
))
{
if
(
strncmp
(
$line
,
'* @since '
,
9
)
===
0
)
{
if
(
substr_compare
(
$line
,
'* @since '
,
0
,
9
)
===
0
)
{
$seenSince
=
true
;
$seenSince
=
true
;
}
elseif
(
strncmp
(
$line
,
'* @author '
,
10
)
===
0
)
{
}
elseif
(
substr_compare
(
$line
,
'* @author '
,
0
,
10
)
===
0
)
{
$seenAuthor
=
true
;
$seenAuthor
=
true
;
}
}
}
}
}
...
@@ -471,13 +469,13 @@ class PhpDocController extends Controller
...
@@ -471,13 +469,13 @@ class PhpDocController extends Controller
$propertyPosition
=
false
;
$propertyPosition
=
false
;
foreach
(
$lines
as
$i
=>
$line
)
{
foreach
(
$lines
as
$i
=>
$line
)
{
$line
=
trim
(
$line
);
$line
=
trim
(
$line
);
if
(
!
empty
(
$line
)
&&
substr_compare
(
$line
,
'* @property '
,
0
,
12
)
===
0
)
{
if
(
strncmp
(
$line
,
'* @property '
,
12
)
===
0
)
{
$propertyPart
=
true
;
$propertyPart
=
true
;
}
elseif
(
$propertyPart
&&
$line
==
'*'
)
{
}
elseif
(
$propertyPart
&&
$line
==
'*'
)
{
$propertyPosition
=
$i
;
$propertyPosition
=
$i
;
$propertyPart
=
false
;
$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
;
$propertyPosition
=
$i
-
1
;
$propertyPart
=
false
;
$propertyPart
=
false
;
}
}
...
...
extensions/authclient/OpenId.php
View file @
100ba6c3
...
@@ -761,7 +761,7 @@ class OpenId extends BaseClient implements ClientInterface
...
@@ -761,7 +761,7 @@ class OpenId extends BaseClient implements ClientInterface
}
else
{
}
else
{
// 'ax' prefix is either undefined, or points to another extension, so we search for another prefix
// 'ax' prefix is either undefined, or points to another extension, so we search for another prefix
foreach
(
$this
->
data
as
$key
=>
$value
)
{
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_'
));
$alias
=
substr
(
$key
,
strlen
(
'openid_ns_'
));
break
;
break
;
}
}
...
@@ -775,7 +775,7 @@ class OpenId extends BaseClient implements ClientInterface
...
@@ -775,7 +775,7 @@ class OpenId extends BaseClient implements ClientInterface
$attributes
=
[];
$attributes
=
[];
foreach
(
$this
->
data
as
$key
=>
$value
)
{
foreach
(
$this
->
data
as
$key
=>
$value
)
{
$keyMatch
=
'openid_'
.
$alias
.
'_value_'
;
$keyMatch
=
'openid_'
.
$alias
.
'_value_'
;
if
(
s
ubstr_compare
(
$key
,
$keyMatch
,
0
,
strlen
(
$keyMatch
)))
{
if
(
s
trncmp
(
$key
,
$keyMatch
,
strlen
(
$keyMatch
)))
{
continue
;
continue
;
}
}
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
...
@@ -802,7 +802,7 @@ class OpenId extends BaseClient implements ClientInterface
...
@@ -802,7 +802,7 @@ class OpenId extends BaseClient implements ClientInterface
$sregToAx
=
array_flip
(
$this
->
axToSregMap
);
$sregToAx
=
array_flip
(
$this
->
axToSregMap
);
foreach
(
$this
->
data
as
$key
=>
$value
)
{
foreach
(
$this
->
data
as
$key
=>
$value
)
{
$keyMatch
=
'openid_sreg_'
;
$keyMatch
=
'openid_sreg_'
;
if
(
s
ubstr_compare
(
$key
,
$keyMatch
,
0
,
strlen
(
$keyMatch
)))
{
if
(
s
trncmp
(
$key
,
$keyMatch
,
strlen
(
$keyMatch
)))
{
continue
;
continue
;
}
}
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
...
...
framework/console/controllers/MessageController.php
View file @
100ba6c3
...
@@ -332,7 +332,7 @@ class MessageController extends Controller
...
@@ -332,7 +332,7 @@ class MessageController extends Controller
ksort
(
$existingMessages
);
ksort
(
$existingMessages
);
foreach
(
$existingMessages
as
$message
=>
$translation
)
{
foreach
(
$existingMessages
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
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
;
$todo
[
$message
]
=
$translation
;
}
else
{
}
else
{
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
...
...
framework/i18n/GettextMoFile.php
View file @
100ba6c3
...
@@ -109,7 +109,7 @@ class GettextMoFile extends GettextFile
...
@@ -109,7 +109,7 @@ class GettextMoFile extends GettextFile
$separatorPosition
=
strpos
(
$id
,
chr
(
4
));
$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
))
{
(
!
$context
&&
$separatorPosition
===
false
))
{
if
(
$separatorPosition
!==
false
)
{
if
(
$separatorPosition
!==
false
)
{
$id
=
substr
(
$id
,
$separatorPosition
+
1
);
$id
=
substr
(
$id
,
$separatorPosition
+
1
);
...
...
framework/i18n/MessageFormatter.php
View file @
100ba6c3
...
@@ -392,7 +392,7 @@ class MessageFormatter extends Component
...
@@ -392,7 +392,7 @@ class MessageFormatter extends Component
}
}
$selector
=
trim
(
$plural
[
$i
++
]);
$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
));
$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
));
$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