Thanks to visit codestin.com
Credit goes to github.com

Skip to content

select() sets new index even on error #836

@ProgerXP

Description

@ProgerXP
$redis = new Redis;
$redis->connect('127.0.0.1');
// int(0)
var_dump($redis->getDbNum());
// Sends SELECT -1, Redis replies with -ERR invalid DB index.
// This prints false. Could also be done with index = 1000 (which is invalid in Redis).
var_dump($redis->select(-1));
// int(-1)
var_dump($redis->getDbNum());

Clearly the last call should print int(0) or whatever the original, previously correctly set database index was.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions