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

Code does not trap for an "empty" $modname #716

Open
mhughes2k opened this issue Jul 5, 2024 · 1 comment
Open

Code does not trap for an "empty" $modname #716

mhughes2k opened this issue Jul 5, 2024 · 1 comment

Comments

@mhughes2k
Copy link

mhughes2k commented Jul 5, 2024

Line 2905 in turnitin/lib.php has a condition where the $modname can end up being "".

This line

$moduleclass = "turnitin_".$modname;
does not check that $modname is not empty and on that assumption tries to instantiate a class called "turnitin_".

This should have a check that the class is a valid one.

This seems to be caused by

isset($formwrapper->get_current()->modulename) ? 'mod_'.$formwrapper->get_current()->modulename : '');
which checks for a mod name being set and if not found sets $modname to '', which will result in never finding a valid class in the line above.

So either you need to validate the instantiation of the class to a valid class name or there is something incorrect that L2908 is ending up with an empty modname.

@jack-tii
Copy link
Contributor

Thanks for flagging this up. I'll make sure this is checked for in our next release.

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

No branches or pull requests

2 participants