Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: handle null values in array_reverse call #27 #28

Open
wants to merge 1 commit into
base: MOODLE_39_STABLE
Choose a base branch
from

Conversation

rajandangi
Copy link

Added a type check to ensure $criteria['levels'] is set and is an array before using array_reverse.

Closes #27

@rajandangi rajandangi self-assigned this Oct 24, 2024
$this->definition->rubric_criteria[$rcid]['levels'] =
array_reverse($this->definition->rubric_criteria[$rcid]['levels'], true);
foreach ($this->definition->rubric_criteria as $rcid => $criteria) {
if (!empty($criteria['levels']) && is_array($criteria['levels'])) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what use cases $criteria['levels'] can be empty or not an array?

@dmitriim
Copy link
Member

@rajandangi thank you for submitting a patch. As it's missing automated tests, can you please provide some manual testing instructions to verify that the patch works as intended? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants