MDL-66968 php74: array_key_exists() for objects is deprecated
Replace it for correct property_exists() when the element being inspected is a property of object/class. Amended and squased changes: - keep mongo unmodified. The information is array, hence correct. - fix a couple of messaging phpdocs that were incorrect. Amended take#2: - As far as mongo resturns BSONDocument that is ArrayObject, aka implements ArrayAccess, we have decided to explicitly cast results to array so existing array_key_exists() and other accesses will continue working the same.
This commit is contained in:
@@ -3839,7 +3839,7 @@ class api {
|
||||
if (!$userevidence->can_manage()) {
|
||||
throw new required_capability_exception($context, 'moodle/competency:userevidencemanage', 'nopermissions', '');
|
||||
|
||||
} else if (array_key_exists('userid', $data) && $data->userid != $userevidence->get('userid')) {
|
||||
} else if (property_exists($data, 'userid') && $data->userid != $userevidence->get('userid')) {
|
||||
throw new coding_exception('Can not change the userid of a user evidence.');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user