Exception in return from 'getToolVisibility' if the tool is not found for a session #5224
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
chamilo-lms/main/inc/lib/course_home.lib.php
Lines 1868 to 1873 in 400f7a4
This pull request fixes this issue by initializing the $visibility variable to false right before the if statement