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.
This commit is contained in:
Frederic Massart 2014-01-29 10:01:17 +08:00
parent 76e4de31cc
commit cea24f4852

View File

@ -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;