MDL-50177 completion: Also accepting cm integer strings
authorDavid Monllao <davidm@moodle.com>
Mon, 11 May 2015 08:56:06 +0000 (16:56 +0800)
committerDavid Monllao <davidm@moodle.com>
Tue, 12 May 2015 04:19:43 +0000 (12:19 +0800)
availability/condition/completion/classes/condition.php

index d057c30..11f86c8 100644 (file)
@@ -53,8 +53,8 @@ class condition extends \core_availability\condition {
      */
     public function __construct($structure) {
         // Get cmid.
-        if (isset($structure->cm) && is_int($structure->cm)) {
-            $this->cmid = $structure->cm;
+        if (isset($structure->cm) && is_number($structure->cm)) {
+            $this->cmid = (int)$structure->cm;
         } else {
             throw new \coding_exception('Missing or invalid ->cm for completion condition');
         }