Skip to content

Commit

Permalink
MongoDB: Use ObjectID only if used
Browse files Browse the repository at this point in the history
  • Loading branch information
vrana committed Feb 9, 2021
1 parent 5d31711 commit a61a767
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions adminer/drivers/mongo.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -300,10 +300,8 @@ function where_to_query($whereAnd = array(), $whereOr = array()) {
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)) {
Expand Down

0 comments on commit a61a767

Please sign in to comment.