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 array_key_exists() type error in userfiltering.php #22

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

my-curiosity
Copy link

Hello,
I noticed that user filtering on the Reports page throws an exception with php 8:

Exception - array_key_exists(): Argument #2 ($array) must be of type array, stdClass given
Stack trace:
line 416 of /mod/hotpot/report/userfiltering.php: TypeError thrown
line 111 of /user/filters/lib.php: call to hotpot_filter_number->check_data()
line 184 of /mod/hotpot/report/renderer.php: call to user_filtering->__construct()
line 124 of /mod/hotpot/report/renderer.php: call to mod_hotpot_report_renderer->display_filters()
line 98 of /mod/hotpot/report/renderer.php: call to mod_hotpot_report_renderer->reportcontent()
line 93 of /mod/hotpot/report.php: call to mod_hotpot_report_renderer->render_report()

A quick fix done in this PR is to cast $formdata to an array in the function call. Alternatively, we could use property_exists(), which works with objects.

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.

1 participant