MDL-62619 privacy: Prevent action when boolean queries are involved
authorEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 9 Aug 2018 14:05:55 +0000 (16:05 +0200)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Thu, 9 Aug 2018 14:05:55 +0000 (16:05 +0200)
commitc9840c0144efaa9dd201fb3b1b3c3dae021858c1
tree661c5c15a8d9fc89e95a52c39d17a8462e708703
parentb76d8da4a664ef2498d1d31b4ee2f11066648a58
MDL-62619 privacy: Prevent action when boolean queries are involved

Before the patch, queries like:

SELECT 1 FROM dual UNION SELECT 2 FROM dual

were failing badly, with everything but the first numeric element
being ignored by the optimization.

So, being conservative, now we reduce the query being analysed,
ignoring any subquery, inline view (anything within parenthesis
in general) and, in the remaining query, if a boolean query (UNION,
MINUS, INTERSECT...) is found, we don't apply any optimization.
privacy/classes/local/request/contextlist.php
privacy/tests/contextlist_test.php