mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Compare with null instead of isset
This commit is contained in:
@ -29,7 +29,7 @@ class Request extends \yii\base\Request
|
||||
*/
|
||||
public function getParams()
|
||||
{
|
||||
if (!isset($this->_params)) {
|
||||
if ($this->_params === null) {
|
||||
if (isset($_SERVER['argv'])) {
|
||||
$this->_params = $_SERVER['argv'];
|
||||
array_shift($this->_params);
|
||||
|
@ -120,7 +120,7 @@ class AccessControl extends ActionFilter
|
||||
} elseif ($allow === false) {
|
||||
if (isset($rule->denyCallback)) {
|
||||
call_user_func($rule->denyCallback, $rule, $action);
|
||||
} elseif (isset($this->denyCallback)) {
|
||||
} elseif ($this->denyCallback !== null) {
|
||||
call_user_func($this->denyCallback, $rule, $action);
|
||||
} else {
|
||||
$this->denyAccess($user);
|
||||
@ -128,7 +128,7 @@ class AccessControl extends ActionFilter
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (isset($this->denyCallback)) {
|
||||
if ($this->denyCallback !== null) {
|
||||
call_user_func($this->denyCallback, null, $action);
|
||||
} else {
|
||||
$this->denyAccess($user);
|
||||
|
@ -57,7 +57,7 @@ class ActiveFixture extends BaseActiveFixture
|
||||
public function init()
|
||||
{
|
||||
parent::init();
|
||||
if (!isset($this->modelClass) && !isset($this->tableName)) {
|
||||
if ($this->modelClass === null && $this->tableName === null) {
|
||||
throw new InvalidConfigException('Either "modelClass" or "tableName" must be set.');
|
||||
}
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ class DbSession extends MultiFieldSession
|
||||
$query->from($this->sessionTable)
|
||||
->where('[[expire]]>:expire AND [[id]]=:id', [':expire' => time(), ':id' => $id]);
|
||||
|
||||
if (isset($this->readCallback)) {
|
||||
if ($this->readCallback !== null) {
|
||||
$fields = $query->one($this->db);
|
||||
return $fields === false ? '' : $this->extractData($fields);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ abstract class MultiFieldSession extends Session
|
||||
$fields = [
|
||||
'data' => $data,
|
||||
];
|
||||
if (isset($this->writeCallback)) {
|
||||
if ($this->writeCallback !== null) {
|
||||
$fields = array_merge(
|
||||
$fields,
|
||||
call_user_func($this->writeCallback, $this)
|
||||
@ -123,7 +123,7 @@ abstract class MultiFieldSession extends Session
|
||||
*/
|
||||
protected function extractData($fields)
|
||||
{
|
||||
if (isset($this->readCallback)) {
|
||||
if ($this->readCallback !== null) {
|
||||
if (!isset($fields['data'])) {
|
||||
$fields['data'] = '';
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ $application = new yii\console\Application([
|
||||
'basePath' => __DIR__ . '/console',
|
||||
'controllerNamespace' => 'yii\console\controllers',
|
||||
]);
|
||||
if (isset($vendorPath)) {
|
||||
if ($vendorPath !== null) {
|
||||
$application->setVendorPath($vendorPath);
|
||||
}
|
||||
$exitCode = $application->run();
|
||||
|
Reference in New Issue
Block a user