mirror of
https://github.com/predis/predis.git
synced 2026-08-30 12:15:03 +00:00
Improved the parser for responses to INFO commands
This commit is contained in:
+11
-1
@@ -1093,7 +1093,17 @@ class Info extends \Predis\InlineCommand {
|
||||
$infoLines = explode("\r\n", $data, -1);
|
||||
foreach ($infoLines as $row) {
|
||||
list($k, $v) = explode(':', $row);
|
||||
$info[$k] = $v;
|
||||
if (!preg_match('/^db\d+$/', $k)) {
|
||||
$info[$k] = $v;
|
||||
}
|
||||
else {
|
||||
$db = array();
|
||||
foreach (explode(',', $v) as $dbvar) {
|
||||
list($dbvk, $dbvv) = explode('=', $dbvar);
|
||||
$db[trim($dbvk)] = $dbvv;
|
||||
}
|
||||
$info[$k] = $db;
|
||||
}
|
||||
}
|
||||
return $info;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user