MDL-76356 various: avoid implicit conversion to arrays

PHP before version 8.1 automatically converted stdClass or 'false' to arrays if
function parameter expects array (for example, "reset").
PHP 8.1 shows notices in these situations
This commit is contained in:
Marina Glancy
2023-01-10 15:03:40 +01:00
committed by Eloy Lafuente (stronk7)
parent cd072308e5
commit 66dcb1683b
5 changed files with 6 additions and 4 deletions
+1 -1
View File
@@ -1055,7 +1055,7 @@ class completion_info {
if (!isset($this->course->cacherev)) {
$this->course = get_course($this->course_id);
}
if ($cacheddata = $completioncache->get($key)) {
if ($cacheddata = ($completioncache->get($key) ?: [])) {
if ($cacheddata['cacherev'] != $this->course->cacherev) {
// Course structure has been changed since the last caching, forget the cache.
$cacheddata = array();