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

Exception in return from 'getToolVisibility' if the tool is not found for a session #5224

Open
wants to merge 1 commit into
base: 1.11.x
Choose a base branch
from

Conversation

juancp-contidosdixitais
Copy link

It is possible to have sessions in which the visibility of the 'document' tool (or any other) is not set in the c_tool table. However, there will still be a record for the base course, allowing the session to inherit this configuration without specifically creating a new record in that table. This approach works in most use cases.

However, with the CKEditor File Manager, we might encounter a problem. In course_home.lib.php.getToolVisibility($toolName, $courseId, $sessionId = 0), an exception could be thrown when opening the File Manager. This is because it checks for the 'document' tool's visibility for the session, but the $visibility variable is not initialized unless there is a corresponding record for the session in the c_tool table

if ($tool) {
$visibility = $tool->getVisibility();
}
return $visibility;

error

This pull request fixes this issue by initializing the $visibility variable to false right before the if statement

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.

None yet

2 participants