Improved the parser for responses to INFO commands

This commit is contained in:
Daniele Alessandri
2009-11-12 14:38:01 +01:00
parent 1a8f832d6c
commit afa72fceb2
+11 -1
View File
@@ -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;
}