anthology-ally / moodle-tool_ally

1 stars 16 forks source link

$filescontenthash not declared soon enough in admin/tool/ally/classes/componentsupport/traits/embedded_file_map.php #95

Open cborn opened 6 months ago

cborn commented 6 months ago

We were having an intermittent issue relating to uploading files to our moodle courses. Sometimes, our faculty would upload a document as an attachment to a forum post, or embeded in a Text label, and they would get an incredibly unhelpful error from php complaining that a variable was undefined. Then they would lose all of their edits and uploads.

After turning debugging all the way up, we got the following: Screenshot 2024-03-21 at 4 09 42 PM

To fix this, we moved the declaration of $filescontenthash = []; up a level from line 166 to line 162.

After doing that, no error occurred and all edits and file uploads are saved.