MDL-47509 Profile restriction: Broken Oracle causes problem
authorsam marshall <s.marshall@open.ac.uk>
Thu, 2 Oct 2014 10:11:30 +0000 (11:11 +0100)
committerEloy Lafuente (stronk7) <stronk7@moodle.org>
Tue, 7 Oct 2014 23:45:28 +0000 (01:45 +0200)
availability/condition/profile/classes/condition.php

index a156e4b..bc0b587 100644 (file)
@@ -538,10 +538,12 @@ class condition extends \core_availability\condition {
                 break;
             case self::OP_IS_EMPTY:
                 // Mimic PHP empty() behaviour for strings, '0' or ''.
-                $sql = '(' . $field . " IN ('0', '') OR $field2 IS NULL)";
+                $emptystring = self::unique_sql_parameter($params, '');
+                $sql = '(' . $field . " IN ('0', $emptystring) OR $field2 IS NULL)";
                 break;
             case self::OP_IS_NOT_EMPTY:
-                $sql = '(' . $field . " NOT IN ('0', '') AND $field2 IS NOT NULL)";
+                $emptystring = self::unique_sql_parameter($params, '');
+                $sql = '(' . $field . " NOT IN ('0', $emptystring) AND $field2 IS NOT NULL)";
                 break;
         }
         return array($sql, $params);