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:
Eloy Lafuente (stronk7)
2019-10-25 00:49:04 +02:00
parent aaff6692a1
commit f4feabb83f
21 changed files with 36 additions and 30 deletions
+1 -1
View File
@@ -77,7 +77,7 @@ if (($form = data_submitted()) && confirm_sesskey()) {
// Record the site preference.
$preferences[$processor->name.'_provider_'.$componentprovidersetting] = $value;
}
} else if (array_key_exists($componentprovidersetting, $form)) {
} else if (property_exists($form, $componentprovidersetting)) {
// We must be processing loggedin or loggedoff checkboxes. Store
// defained comma-separated processors as setting value.
// Using array_filter eliminates elements set to 0 above.