Closed tallevi12 closed 9 years ago
Thanks for the report :)
This bug fixed.
There is a problem with the fix https://github.com/catfan/Medoo/commit/76574afc684ea95a7e8c101aef4d1e126e73e76c
The regexp won't match single 'OR' or single 'AND' (without ' #...' after), so a query like this won't work :
if ($database->has("account", [ "AND" => [ "OR" => [ "user_name" => "foo", "email" => "foo" ], "password" => "12345" ] ]))
because of imbricated AND/OR.
Here's a better fix :
/^(AND|OR)(\s+#.*)?$/i
@4t0m1k Good point :)
When I tried to run this query : $orders = $db->select('orders','order_id',[ 'AND' => [ "order_id" => [1,2,3], "done" => false ] ]);
The query does not return what I'm expected, I started to debug it and i figure out that it happens only when the key start with "or.." (i.e. order_id), when I changed it to another string (that doesn't starts with or..) that works.