SCA with Php Inspections (EA Ultimate)

This commit is contained in:
Vladimir Reznichenko
2018-02-27 19:13:22 +01:00
parent f9b03dfd42
commit f10cb6aeee
10 changed files with 14 additions and 12 deletions

View File

@ -72,8 +72,9 @@ trait DynamicContentAwareTrait
$content = strtr($content, $placeholders);
}
if ($isRestoredFromCache) {
$view = $this->getView();
foreach ($placeholders as $name => $statements) {
$this->getView()->addDynamicPlaceholder($name, $statements);
$view->addDynamicPlaceholder($name, $statements);
}
}

View File

@ -191,7 +191,7 @@ class CaptchaAction extends Action
$session = Yii::$app->getSession();
$session->open();
$name = $this->getSessionKey() . 'count';
$session[$name] = $session[$name] + 1;
$session[$name] += 1;
if ($valid || $session[$name] > $this->testLimit && $this->testLimit > 0) {
$this->getVerifyCode(true);
}

View File

@ -1025,7 +1025,7 @@ class Connection extends Component
public function getMaster()
{
if ($this->_master === false) {
$this->_master = ($this->shuffleMasters)
$this->_master = $this->shuffleMasters
? $this->openFromPool($this->masters, $this->masterConfig)
: $this->openFromPoolSequentially($this->masters, $this->masterConfig);
}

View File

@ -668,7 +668,7 @@ PATTERN;
if ($existsInSelect) {
continue;
}
} elseif (is_integer($columnAlias)) {
} elseif (is_int($columnAlias)) {
$existsInSelect = in_array($columnDefinition, $unaliasedColumns, true);
$existsInResultSet = in_array($columnDefinition, $result, true);
if ($existsInSelect || $existsInResultSet) {
@ -691,7 +691,7 @@ PATTERN;
$result = [];
if (is_array($this->select)) {
foreach ($this->select as $name => $value) {
if (is_integer($name)) {
if (is_int($name)) {
$result[] = $value;
}
}

View File

@ -938,7 +938,7 @@ class BaseArrayHelper
continue;
}
if (!key_exists($globalKey, $array)) {
if (!array_key_exists($globalKey, $array)) {
continue;
}
if ($localKey === null) {

View File

@ -367,7 +367,7 @@ class BaseFileHelper
if (!is_dir($dir)) {
return;
}
if (isset($options['traverseSymlinks']) && $options['traverseSymlinks'] || !is_link($dir)) {
if (!empty($options['traverseSymlinks']) || !is_link($dir)) {
if (!($handle = opendir($dir))) {
return;
}

View File

@ -1624,7 +1624,7 @@ class Formatter extends Component
if (abs($value) < $formatBase) {
break;
}
$value = $value / $formatBase;
$value /= $formatBase;
}
$position++;
} while ($position < $maxPosition + 1);

View File

@ -39,7 +39,8 @@ class OptionsAction extends \yii\base\Action
Yii::$app->getResponse()->setStatusCode(405);
}
$options = $id === null ? $this->collectionOptions : $this->resourceOptions;
Yii::$app->getResponse()->getHeaders()->set('Allow', implode(', ', $options));
Yii::$app->getResponse()->getHeaders()->set('Access-Control-Allow-Method', implode(', ', $options));
$headers = Yii::$app->getResponse()->getHeaders();
$headers->set('Allow', implode(', ', $options));
$headers->set('Access-Control-Allow-Method', implode(', ', $options));
}
}

View File

@ -125,7 +125,7 @@ class NumberValidator extends Validator
{
return is_array($value)
|| (is_object($value) && !method_exists($value, '__toString'))
|| (!is_object($value) && !is_scalar($value) && !is_null($value));
|| (!is_object($value) && !is_scalar($value) && $value !== null);
}
/**

View File

@ -1196,7 +1196,7 @@ class Request extends \yii\base\Request
* RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
*/
$auth_token = $this->getHeaders()->get('HTTP_AUTHORIZATION') ?: $this->getHeaders()->get('REDIRECT_HTTP_AUTHORIZATION');
if ($auth_token !== null && strpos(strtolower($auth_token), 'basic') === 0) {
if ($auth_token !== null && stripos($auth_token, 'basic') === 0) {
$parts = array_map(function ($value) {
return strlen($value) === 0 ? null : $value;
}, explode(':', base64_decode(mb_substr($auth_token, 6)), 2));