yiisoft / yii2-redis

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

在php7.1版本时readSession 当redis返回null时 不是字符串报错 #172

Open hkui opened 5 years ago

hkui commented 5 years ago

| Yii vesion 2.0.15 | PHP version 7.1 | Operating system centos redis:4.0.2 `/**

$data=null时 就不全等于false了,返回的是null session_start(): Failed to read session data: user (path: ) php7.1里readSession必须返回字符串

cebe commented 5 years ago

can you show a stack trace of the exception?

hkui commented 5 years ago

can you show a stack trace of the exception? yii-redis-bug

machour commented 5 years ago

Confirmed, I see this problem on the Cache component too, where getValue() returns NULL instead of false when checking for a key existence.

Redis returns "-1" when a key is not found, and this fall into this case:

https://github.com/yiisoft/yii2-redis/blob/98fc1c53385736343e67963826ee8fa420ee5e21/src/Connection.php#L740-L743