Moodle
  1. Moodle
  2. MDL-32312

Cache of function format_text works not properly with input in wrong encoding

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 1.9.13
    • Fix Version/s: None
    • Component/s: General
    • Labels:
      None
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      39121

      Description

      Some special chars in text are interpreted as MySQL escape-chars, when in wrong encoding. Saving this text in the cache_text table by the function format_string is not working and leads to shortened text. Using that cached text for display leads to display errors (due some div-container are missing) and, of course, missing text.

      We found that bug after using the wiki module. When opening in a course without "page" parameter the funktion format_text will be used. In our case, we found that bug using "Ü". First it displayed all text. After refreshing (when it was using the cached text) the text was missing and div-container where totally messed up.

      We fixed that problem by base64 encode before inserting (insert_record, update_record in function format_text in the weblib.php) in db and decode before the return of the string. Another solution would be disabling the caching, but due we have a huge amount of users (30.000+), we aren't sure, if that will cost much performance.

      Maybe there's another solution, which isn't as dirty as the encoding, but hasn't such an effect on the performance.

        Activity

        Hide
        Michael de Raadt added a comment -

        Thanks for reporting this.

        I'm closing this issue because I believe it affects only Moodle 1.9, which is now unsupported (except for serious security issues). This issue will remain here in case other users have the same problem.

        I encourage you to ugrade to a supported version.

        Show
        Michael de Raadt added a comment - Thanks for reporting this. I'm closing this issue because I believe it affects only Moodle 1.9, which is now unsupported (except for serious security issues). This issue will remain here in case other users have the same problem. I encourage you to ugrade to a supported version.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: