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
07f01bcf
Commit
07f01bcf
authored
Jul 23, 2014
by
Alexander Makarov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Used substr_compare instead of substr when we don't care about result
parent
5c767e5d
Show whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
21 additions
and
21 deletions
+21
-21
PhpDocController.php
build/controllers/PhpDocController.php
+6
-6
TypeDoc.php
extensions/apidoc/models/TypeDoc.php
+1
-1
BaseRenderer.php
extensions/apidoc/renderers/BaseRenderer.php
+1
-1
seeAlso.php
extensions/apidoc/templates/html/views/seeAlso.php
+1
-1
OAuth1.php
extensions/authclient/OAuth1.php
+1
-1
OpenId.php
extensions/authclient/OpenId.php
+3
-3
Generator.php
extensions/gii/generators/model/Generator.php
+1
-1
Generator.php
extensions/gii/generators/module/Generator.php
+1
-1
Generator.php
extensions/sphinx/gii/model/Generator.php
+1
-1
MessageController.php
framework/console/controllers/MessageController.php
+1
-1
CheckboxColumn.php
framework/grid/CheckboxColumn.php
+1
-1
BaseHtml.php
framework/helpers/BaseHtml.php
+1
-1
UrlManager.php
framework/web/UrlManager.php
+1
-1
UrlRule.php
framework/web/UrlRule.php
+1
-1
No files found.
build/controllers/PhpDocController.php
View file @
07f01bcf
...
@@ -170,7 +170,7 @@ class PhpDocController extends Controller
...
@@ -170,7 +170,7 @@ class PhpDocController extends Controller
$namespaceLine
=
''
;
$namespaceLine
=
''
;
$contentAfterNamespace
=
false
;
$contentAfterNamespace
=
false
;
foreach
(
$lines
as
$i
=>
$line
)
{
foreach
(
$lines
as
$i
=>
$line
)
{
if
(
substr
(
trim
(
$line
),
0
,
9
)
===
'namespace'
)
{
if
(
substr
_compare
(
trim
(
$line
),
'namespace'
,
0
,
9
)
===
0
)
{
$namespace
=
$i
;
$namespace
=
$i
;
$namespaceLine
=
trim
(
$line
);
$namespaceLine
=
trim
(
$line
);
}
elseif
(
$namespace
!==
false
&&
trim
(
$line
)
!==
''
)
{
}
elseif
(
$namespace
!==
false
&&
trim
(
$line
)
!==
''
)
{
...
@@ -275,13 +275,13 @@ class PhpDocController extends Controller
...
@@ -275,13 +275,13 @@ 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
);
if
(
trim
(
$lines
[
1
])
==
'*'
||
substr
(
trim
(
$lines
[
1
]),
0
,
3
)
==
'* @'
)
{
if
(
trim
(
$lines
[
1
])
==
'*'
||
substr
_compare
(
trim
(
$lines
[
1
]),
'* @'
,
0
,
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
)
{
if
(
substr
(
trim
(
$line
),
0
,
9
)
==
'* @since '
)
{
if
(
substr
_compare
(
trim
(
$line
),
'* @since '
,
0
,
9
)
===
0
)
{
$seenSince
=
true
;
$seenSince
=
true
;
}
elseif
(
substr
(
trim
(
$line
),
0
,
10
)
==
'* @author '
)
{
}
elseif
(
substr
_compare
(
trim
(
$line
),
'* @author '
,
0
,
10
)
===
0
)
{
$seenAuthor
=
true
;
$seenAuthor
=
true
;
}
}
}
}
...
@@ -350,13 +350,13 @@ class PhpDocController extends Controller
...
@@ -350,13 +350,13 @@ class PhpDocController extends Controller
$propertyPart
=
false
;
$propertyPart
=
false
;
$propertyPosition
=
false
;
$propertyPosition
=
false
;
foreach
(
$lines
as
$i
=>
$line
)
{
foreach
(
$lines
as
$i
=>
$line
)
{
if
(
substr
(
trim
(
$line
),
0
,
12
)
==
'* @property '
)
{
if
(
substr
_compare
(
trim
(
$line
),
'* @property '
,
0
,
12
)
===
0
)
{
$propertyPart
=
true
;
$propertyPart
=
true
;
}
elseif
(
$propertyPart
&&
trim
(
$line
)
==
'*'
)
{
}
elseif
(
$propertyPart
&&
trim
(
$line
)
==
'*'
)
{
$propertyPosition
=
$i
;
$propertyPosition
=
$i
;
$propertyPart
=
false
;
$propertyPart
=
false
;
}
}
if
(
substr
(
trim
(
$line
),
0
,
10
)
==
'* @author '
&&
$propertyPosition
===
false
)
{
if
(
substr
_compare
(
trim
(
$line
),
'* @author '
,
0
,
10
)
===
0
&&
$propertyPosition
===
false
)
{
$propertyPosition
=
$i
-
1
;
$propertyPosition
=
$i
-
1
;
$propertyPart
=
false
;
$propertyPart
=
false
;
}
}
...
...
extensions/apidoc/models/TypeDoc.php
View file @
07f01bcf
...
@@ -46,7 +46,7 @@ class TypeDoc extends BaseDoc
...
@@ -46,7 +46,7 @@ class TypeDoc extends BaseDoc
}
}
}
}
}
}
if
(
substr
(
$subjectName
,
-
2
,
2
)
==
'()'
)
{
if
(
substr
_compare
(
$subjectName
,
'()'
,
-
2
,
2
)
===
0
)
{
return
null
;
return
null
;
}
}
if
(
$this
->
properties
===
null
)
{
if
(
$this
->
properties
===
null
)
{
...
...
extensions/apidoc/renderers/BaseRenderer.php
View file @
07f01bcf
...
@@ -72,7 +72,7 @@ abstract class BaseRenderer extends Component
...
@@ -72,7 +72,7 @@ abstract class BaseRenderer extends Component
foreach
(
$types
as
$type
)
{
foreach
(
$types
as
$type
)
{
$postfix
=
''
;
$postfix
=
''
;
if
(
!
is_object
(
$type
))
{
if
(
!
is_object
(
$type
))
{
if
(
substr
(
$type
,
-
2
,
2
)
==
'[]'
)
{
if
(
substr
_compare
(
$type
,
'[]'
,
-
2
,
2
)
===
0
)
{
$postfix
=
'[]'
;
$postfix
=
'[]'
;
$type
=
substr
(
$type
,
0
,
-
2
);
$type
=
substr
(
$type
,
0
,
-
2
);
}
}
...
...
extensions/apidoc/templates/html/views/seeAlso.php
View file @
07f01bcf
...
@@ -23,7 +23,7 @@ if (empty($see)) {
...
@@ -23,7 +23,7 @@ if (empty($see)) {
}
else
{
}
else
{
echo
'<p>See also:</p><ul>'
;
echo
'<p>See also:</p><ul>'
;
foreach
(
$see
as
$ref
)
{
foreach
(
$see
as
$ref
)
{
if
(
substr
(
$ref
,
-
1
,
1
)
!=
'>'
)
{
if
(
substr
_compare
(
$ref
,
'>'
,
-
1
,
1
)
)
{
$ref
.=
'.'
;
$ref
.=
'.'
;
}
}
echo
"<li>
$ref
</li>"
;
echo
"<li>
$ref
</li>"
;
...
...
extensions/authclient/OAuth1.php
View file @
07f01bcf
...
@@ -349,7 +349,7 @@ class OAuth1 extends BaseOAuth
...
@@ -349,7 +349,7 @@ class OAuth1 extends BaseOAuth
$headerParams
[]
=
'realm="'
.
rawurlencode
(
$realm
)
.
'"'
;
$headerParams
[]
=
'realm="'
.
rawurlencode
(
$realm
)
.
'"'
;
}
}
foreach
(
$params
as
$key
=>
$value
)
{
foreach
(
$params
as
$key
=>
$value
)
{
if
(
substr
(
$key
,
0
,
5
)
!=
'oauth'
)
{
if
(
substr
_compare
(
$key
,
'oauth'
,
0
,
5
)
)
{
continue
;
continue
;
}
}
$headerParams
[]
=
rawurlencode
(
$key
)
.
'="'
.
rawurlencode
(
$value
)
.
'"'
;
$headerParams
[]
=
rawurlencode
(
$key
)
.
'="'
.
rawurlencode
(
$value
)
.
'"'
;
...
...
extensions/authclient/OpenId.php
View file @
07f01bcf
...
@@ -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
(
substr
(
$key
,
0
,
strlen
(
'openid_ns_'
))
==
'openid_ns_'
&&
$value
==
'http://openid.net/srv/ax/1.0'
)
{
if
(
substr
_compare
(
$key
,
'openid_ns_'
,
0
,
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
(
substr
(
$key
,
0
,
strlen
(
$keyMatch
))
!=
$keyMatch
)
{
if
(
substr
_compare
(
$key
,
$keyMatch
,
0
,
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
(
substr
(
$key
,
0
,
strlen
(
$keyMatch
))
!=
$keyMatch
)
{
if
(
substr
_compare
(
$key
,
$keyMatch
,
0
,
strlen
(
$keyMatch
))
)
{
continue
;
continue
;
}
}
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
$key
=
substr
(
$key
,
strlen
(
$keyMatch
));
...
...
extensions/gii/generators/model/Generator.php
View file @
07f01bcf
...
@@ -478,7 +478,7 @@ class Generator extends \yii\gii\Generator
...
@@ -478,7 +478,7 @@ class Generator extends \yii\gii\Generator
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
}
}
if
(
substr
(
$this
->
tableName
,
-
1
)
!==
'*'
&&
$this
->
modelClass
==
''
)
{
if
(
substr
_compare
(
$this
->
tableName
,
'*'
,
-
1
)
&&
$this
->
modelClass
==
''
)
{
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
}
}
}
}
...
...
extensions/gii/generators/module/Generator.php
View file @
07f01bcf
...
@@ -146,7 +146,7 @@ EOD;
...
@@ -146,7 +146,7 @@ EOD;
if
(
strpos
(
$this
->
moduleClass
,
'\\'
)
===
false
||
Yii
::
getAlias
(
'@'
.
str_replace
(
'\\'
,
'/'
,
$this
->
moduleClass
),
false
)
===
false
)
{
if
(
strpos
(
$this
->
moduleClass
,
'\\'
)
===
false
||
Yii
::
getAlias
(
'@'
.
str_replace
(
'\\'
,
'/'
,
$this
->
moduleClass
),
false
)
===
false
)
{
$this
->
addError
(
'moduleClass'
,
'Module class must be properly namespaced.'
);
$this
->
addError
(
'moduleClass'
,
'Module class must be properly namespaced.'
);
}
}
if
(
substr
(
$this
->
moduleClass
,
-
1
,
1
)
==
'\\'
)
{
if
(
substr
_compare
(
$this
->
moduleClass
,
'\\'
,
-
1
,
1
)
===
0
)
{
$this
->
addError
(
'moduleClass'
,
'Module class name must not be empty. Please enter a fully qualified class name. e.g. "app\\modules\\admin\\Module".'
);
$this
->
addError
(
'moduleClass'
,
'Module class name must not be empty. Please enter a fully qualified class name. e.g. "app\\modules\\admin\\Module".'
);
}
}
}
}
...
...
extensions/sphinx/gii/model/Generator.php
View file @
07f01bcf
...
@@ -266,7 +266,7 @@ class Generator extends \yii\gii\Generator
...
@@ -266,7 +266,7 @@ class Generator extends \yii\gii\Generator
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
if
(
$this
->
isReservedKeyword
(
$this
->
modelClass
))
{
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
$this
->
addError
(
'modelClass'
,
'Class name cannot be a reserved PHP keyword.'
);
}
}
if
(
substr
(
$this
->
indexName
,
-
1
)
!==
'*'
&&
$this
->
modelClass
==
''
)
{
if
(
substr
_compare
(
$this
->
indexName
,
'*'
,
-
1
)
&&
$this
->
modelClass
==
''
)
{
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
$this
->
addError
(
'modelClass'
,
'Model Class cannot be blank if table name does not end with asterisk.'
);
}
}
}
}
...
...
framework/console/controllers/MessageController.php
View file @
07f01bcf
...
@@ -333,7 +333,7 @@ class MessageController extends Controller
...
@@ -333,7 +333,7 @@ class MessageController extends Controller
ksort
(
$translated
);
ksort
(
$translated
);
foreach
(
$translated
as
$message
=>
$translation
)
{
foreach
(
$translated
as
$message
=>
$translation
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
if
(
!
isset
(
$merged
[
$message
])
&&
!
isset
(
$todo
[
$message
])
&&
!
$removeUnused
)
{
if
(
substr
(
$translation
,
0
,
2
)
===
'@@'
&&
substr
(
$translation
,
-
2
)
===
'@@'
)
{
if
(
substr
_compare
(
$translation
,
'@@'
,
0
,
2
)
===
0
&&
substr_compare
(
$translation
,
'@@'
,
-
2
)
===
0
)
{
$todo
[
$message
]
=
$translation
;
$todo
[
$message
]
=
$translation
;
}
else
{
}
else
{
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
$todo
[
$message
]
=
'@@'
.
$translation
.
'@@'
;
...
...
framework/grid/CheckboxColumn.php
View file @
07f01bcf
...
@@ -63,7 +63,7 @@ class CheckboxColumn extends Column
...
@@ -63,7 +63,7 @@ class CheckboxColumn extends Column
if
(
empty
(
$this
->
name
))
{
if
(
empty
(
$this
->
name
))
{
throw
new
InvalidConfigException
(
'The "name" property must be set.'
);
throw
new
InvalidConfigException
(
'The "name" property must be set.'
);
}
}
if
(
substr
(
$this
->
name
,
-
2
)
!==
'[]'
)
{
if
(
substr
_compare
(
$this
->
name
,
'[]'
,
-
2
)
)
{
$this
->
name
.=
'[]'
;
$this
->
name
.=
'[]'
;
}
}
}
}
...
...
framework/helpers/BaseHtml.php
View file @
07f01bcf
...
@@ -803,7 +803,7 @@ class BaseHtml
...
@@ -803,7 +803,7 @@ class BaseHtml
$options
[
'name'
]
=
$name
;
$options
[
'name'
]
=
$name
;
if
(
isset
(
$options
[
'unselect'
]))
{
if
(
isset
(
$options
[
'unselect'
]))
{
// add a hidden field so that if the list box has no option being selected, it still submits a value
// add a hidden field so that if the list box has no option being selected, it still submits a value
if
(
substr
(
$name
,
-
2
)
===
'[]'
)
{
if
(
substr
_compare
(
$name
,
'[]'
,
-
2
)
===
0
)
{
$name
=
substr
(
$name
,
0
,
-
2
);
$name
=
substr
(
$name
,
0
,
-
2
);
}
}
$hidden
=
static
::
hiddenInput
(
$name
,
$options
[
'unselect'
]);
$hidden
=
static
::
hiddenInput
(
$name
,
$options
[
'unselect'
]);
...
...
framework/web/UrlManager.php
View file @
07f01bcf
...
@@ -238,7 +238,7 @@ class UrlManager extends Component
...
@@ -238,7 +238,7 @@ class UrlManager extends Component
$suffix
=
(
string
)
$this
->
suffix
;
$suffix
=
(
string
)
$this
->
suffix
;
if
(
$suffix
!==
''
&&
$pathInfo
!==
''
)
{
if
(
$suffix
!==
''
&&
$pathInfo
!==
''
)
{
$n
=
strlen
(
$this
->
suffix
);
$n
=
strlen
(
$this
->
suffix
);
if
(
substr
(
$pathInfo
,
-
$n
)
===
$this
->
suffix
)
{
if
(
substr
_compare
(
$pathInfo
,
$this
->
suffix
,
-
$n
)
===
0
)
{
$pathInfo
=
substr
(
$pathInfo
,
0
,
-
$n
);
$pathInfo
=
substr
(
$pathInfo
,
0
,
-
$n
);
if
(
$pathInfo
===
''
)
{
if
(
$pathInfo
===
''
)
{
// suffix alone is not allowed
// suffix alone is not allowed
...
...
framework/web/UrlRule.php
View file @
07f01bcf
...
@@ -215,7 +215,7 @@ class UrlRule extends Object implements UrlRuleInterface
...
@@ -215,7 +215,7 @@ class UrlRule extends Object implements UrlRuleInterface
$suffix
=
(
string
)
(
$this
->
suffix
===
null
?
$manager
->
suffix
:
$this
->
suffix
);
$suffix
=
(
string
)
(
$this
->
suffix
===
null
?
$manager
->
suffix
:
$this
->
suffix
);
if
(
$suffix
!==
''
&&
$pathInfo
!==
''
)
{
if
(
$suffix
!==
''
&&
$pathInfo
!==
''
)
{
$n
=
strlen
(
$suffix
);
$n
=
strlen
(
$suffix
);
if
(
substr
(
$pathInfo
,
-
$n
)
===
$suffix
)
{
if
(
substr
_compare
(
$pathInfo
,
$suffix
,
-
$n
)
===
0
)
{
$pathInfo
=
substr
(
$pathInfo
,
0
,
-
$n
);
$pathInfo
=
substr
(
$pathInfo
,
0
,
-
$n
);
if
(
$pathInfo
===
''
)
{
if
(
$pathInfo
===
''
)
{
// suffix alone is not allowed
// suffix alone is not allowed
...
...
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