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

Bug: Filter circular reference leads to fatal error #247

Open
8 of 11 tasks
tasosb opened this issue Dec 14, 2022 · 1 comment
Open
8 of 11 tasks

Bug: Filter circular reference leads to fatal error #247

tasosb opened this issue Dec 14, 2022 · 1 comment
Labels
backlog We might get to it in the future but not currently a priority

Comments

@tasosb
Copy link

tasosb commented Dec 14, 2022

Prerequisites

  • I'm reporting the issue to the correct repository.
  • I am running the latest version of this plugin (if not, please upgrade first).
  • I checked the README.md and Wiki documentation but did not find my answer.
  • I searched to make sure that this issue had not already been reported.
  • I have, or I know someone who has, the ability and willingness to test the fix on a Moodle LMS-based site.
  • I am submitting no more than one bug report per issue ticket (please do not submit multiple bugs in one issue ticket).
  • I understand that support is provided by volunteer(s).

What happened?

The plugin doesn't account for possible circular references with certain tags.

For example, a teacher may rename their course to "Test course {coursename}". This will render the course unusable, as when the filter is applied, the course name will be converted "Test course Test course {coursename}" and so on. Moodle will raise a Fatal Error:
Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 262144 bytes) in moodle311\lib\moodlelib.php on line 7301

Similarly, adding {coursesummary} to the summary of the course, will render the moodle mobile application unusable. In the website the summary of the course is visible only on the first page, but it has the front page context and the filter prints the site summary (as expected from the instructions). However, in the mobile app, the summary of the course is visible on the course page and thus has the course context, leading to a similar error as above.

What do you think should have happened?

The plugin should prevent possible circular references in the filters.

Steps to reproduce

  1. Login as a teacher
  2. Create a course with the name "Test course {coursename}"
  3. Save the course
  4. Try navigating to the course

Screenshots

No response

Moodle version

Moodle 3.11.11+ (Build: 20221201)

Installed Moodle UI Language packs.

  • English only
  • One or more other languages/regional dialects (specify below)
  • Other

If other language(s), please specify

No response

Workaround

No response

Additional information

No response

System information

No response

Code of Conduct

@michael-milette
Copy link
Owner

Hi @tasosb ,

Thank you for bringing these issues to my attention. Unfortunately I do not have a quick fix available for you right now because I am not sure how to detect what field the tag is located in.

However, a workaround currently available would be to place square brackets around tags if you do not want them to be interpreted. Example:

Test course [{coursename}]

If you are already experiencing this situation, you could turn FilterCodes off temporarily, update the fields with the square brackets and the re-enable FilterCodes.

Alternatively, you could turn off FilterCodes for a particular course. If you don't want to constantly escape the tags with square brackets.

More information is available in the README.md file included with the plugin.

If you have any suggestions, I would welcome any Pull Requests or suggestions that you might be willing to contribute.

Beat regards,

Michael

@michael-milette michael-milette added the backlog We might get to it in the future but not currently a priority label Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog We might get to it in the future but not currently a priority
Projects
None yet
Development

No branches or pull requests

2 participants