MongoDB: Use ObjectID only if used

This commit is contained in:
Jakub Vrana 2021-02-09 20:19:43 +01:00
parent 5d317111c7
commit a61a76716b

View file

@ -300,10 +300,8 @@ if (isset($_GET["mongo"])) {
if (is_array($where)) {
foreach ($where as $expression) {
list($col, $op, $val) = explode(" ", $expression, 3);
if ($col == "_id") {
$val = str_replace('MongoDB\BSON\ObjectID("', "", $val);
$val = str_replace('")', "", $val);
$class = 'MongoDB\BSON\ObjectID';
if ($col == "_id" && preg_match('~^(MongoDB\\\\BSON\\\\ObjectID)\("(.+)"\)$~', $val, $match)) {
list(, $class, $val) = $match;
$val = new $class($val);
}
if (!in_array($op, $adminer->operators)) {