Skip to content

rainbow grades customization null/array error #12544

Description

@bmcutler

Describe the bug

Accessing the Rainbow Grades customization for an old course crashes with the following error:

16:30:41 03/06/2026 - FATAL ERROR
TypeError (Code: 0) thrown in /usr/local/submitty/site/app/models/RainbowCustomization.php (Line 141) by:
                $this->customization_data[$bucket] = array_values(array_filter($this->customization_data[$bucket], function ($g) use ($gradeable_buckets, $json_bucket) {


Message:
array_filter(): Argument #1 ($array) must be of type array, null given

Stack Trace:
#0 /usr/local/submitty/site/app/models/RainbowCustomization.php(141): array_filter()
#1 /usr/local/submitty/site/app/controllers/admin/ReportController.php(663): app\models\RainbowCustomization->buildCustomization()
#2 unknown file(unknown line): app\controllers\admin\ReportController->generateCustomization()
#3 /usr/local/submitty/site/app/libraries/routers/WebRouter.php(254): call_user_func_array()
#4 /usr/local/submitty/site/app/libraries/routers/WebRouter.php(232): app\libraries\routers\WebRouter->run()
#5 /usr/local/submitty/site/public/index.php(147): app\libraries\routers\WebRouter::getWebResponse()

USER: REDACTED
URL: https://submitty.REDACTED.edu//courses/s20/REDACTED/reports/rainbow_grades_customization

To robustify this code, we should wrap an 'if not null' check around the code to prevent this crash

Expected behavior

To robustify this code, we should wrap an 'if not null' check (or whatever similar logic) around the code to prevent this crash.

To Reproduce

I'm not sure how old the course needs to be, but this error instance was from a Spring 2020 course.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions