From 890e85767e2c998235f8be3dab28b63b8ef55bd8 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 01d89606a6b..c85241bcf8f 100644 --- a/lib/accesslib.php +++ b/lib/accesslib.php @@ -5085,7 +5085,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;