yiisoft / yii2-redis

Yii 2 Redis extension.
http://www.yiiframework.com
BSD 3-Clause "New" or "Revised" License
452 stars 183 forks source link

getIsActive() returns true when socket is not connected #191

Closed rendong237 closed 4 years ago

rendong237 commented 4 years ago

What steps will reproduce the problem?

public function getIsActive()
{
        return ArrayHelper::getValue($this->_pool, "$this->hostname:$this->port") !== false;
}

if before open, invoke getIsActive() return true

if extend connection,require invoke getIsActive to check connection

What's expected?

false

What do you get instead?

true

Additional info

  1. ArrayHelper::getValue($this->_pool, "$this->hostname:$this->port") is null
  2. null !== false
  3. return true
Q A
Yii vesion yii-redis 2.0.11
PHP version
Operating system
samdark commented 4 years ago

@rendong237 thanks for report. Do you want to fix and do a pull request?