From 7ffe38cebf8dc439379950f54d695659fd8c7029 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Wed, 29 Jan 2014 10:01:17 +0800 Subject: [PATCH] MDL-44436 context: Context IDs are forced to be int The method context::insert_context_record() sets the context::$id to an int, while when we create an instance, the $id is often read from a DB $record object, and is a string. The ID should always be an int. --- lib/accesslib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/accesslib.php b/lib/accesslib.php index dca8351568a..56c3a19a465 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -5242,7 +5242,7 @@ abstract class context extends stdClass implements IteratorAggregate { * @param stdClass $record */ protected function __construct(stdClass $record) { - $this->_id = $record->id; + $this->_id = (int)$record->id; $this->_contextlevel = (int)$record->contextlevel; $this->_instanceid = $record->instanceid; $this->_path = $record->path;