]> git.joonet.de Git - adminer.git/commitdiff
MongoDB: Use ObjectID only if used
authorJakub Vrana <jakub@vrana.cz>
Tue, 9 Feb 2021 19:19:43 +0000 (20:19 +0100)
committerJakub Vrana <jakub@vrana.cz>
Tue, 9 Feb 2021 19:19:43 +0000 (20:19 +0100)
adminer/drivers/mongo.inc.php

index 6b043933ad2a7379f5d1d5c974a66d5aeedc9400..7dbcf76bf364af88dfcc83dd1f4cf400bcdc2a5d 100644 (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)) {