Moodle
  1. Moodle
  2. MDL-36212

Some forum mails not sent because of wrong html entity decoding

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.2
    • Fix Version/s: 2.3.4, 2.4.1
    • Component/s: Forum
    • Labels:
    • Testing Instructions:
      Hide

      1/ execute phpunit tests in PHP 5.3.2-3
      2/ execute phpunit tests in PHP >= 5.3.4
      3/ execute phpunit tests in PHP >= 5.4.0

      4/ optionally verify GoogleSpellchecker is working for words with html entities
      5/ optionally compose forum post in markdown format with unicode HTML entities and verify mailed plain text version

      Show
      1/ execute phpunit tests in PHP 5.3.2-3 2/ execute phpunit tests in PHP >= 5.3.4 3/ execute phpunit tests in PHP >= 5.4.0 — 4/ optionally verify GoogleSpellchecker is working for words with html entities 5/ optionally compose forum post in markdown format with unicode HTML entities and verify mailed plain text version
    • Affected Branches:
      MOODLE_23_STABLE
    • Fixed Branches:
      MOODLE_23_STABLE, MOODLE_24_STABLE
    • Pull from Repository:
    • Pull Master Branch:
      w51_MDL-36212_m25_entities

      Description

      The default charset of get_html_translation_table() is ISO-8859-1 for versions of PHP prior to 5.4.0 (http://php.net/manual/en/function.get-html-translation-table.php).

      We've detected the problem because some forum emails (those with html entities) were not being sent because a database error (MySQL):

      Incorrect string value: '\xA0\xA0\xA0\xA0\xA0\xA0...' for column 'fullmessage' at row 1

      To fix the problem pass the encoding parameter to get_html_translation_table():

      get_html_translation_table(HTML_ENTITIES, ENT_COMPAT|ENT_HTML401, 'utf-8');

      Maybe other versions of moodle and other components are affected by this bug.

        Gliffy Diagrams

        1. mdl36212.patch
          1.0 kB
          Juan Segarra Montesinos

          Issue Links

            Activity

            Hide
            Juan Segarra Montesinos added a comment -

            A patch for format_text_email() function

            Show
            Juan Segarra Montesinos added a comment - A patch for format_text_email() function
            Hide
            Petr Skoda added a comment -

            Thanks for the report, I have converted the problematic code to use our fixed textlib class. I am going to file separate issues for the remaining problems.

            Show
            Petr Skoda added a comment - Thanks for the report, I have converted the problematic code to use our fixed textlib class. I am going to file separate issues for the remaining problems.
            Hide
            Sam Hemelryk added a comment -

            Thanks Petr all looks good and has been integrated now.

            Tester: I have run phpunit on all branches for PHP 5.3.15.

            Show
            Sam Hemelryk added a comment - Thanks Petr all looks good and has been integrated now. Tester: I have run phpunit on all branches for PHP 5.3.15.
            Hide
            Ankit Agarwal added a comment - - edited

            I ran phpunit lib/tests/textlib_test.php for:-
            All branches for 5.3.10-1ubuntu3.4
            5.3.2 master

            Michael is testing on php 5.4
            Edit:- working on all branches for 5.4
            Passing
            Thanks

            Show
            Ankit Agarwal added a comment - - edited I ran phpunit lib/tests/textlib_test.php for:- All branches for 5.3.10-1ubuntu3.4 5.3.2 master Michael is testing on php 5.4 Edit:- working on all branches for 5.4 Passing Thanks
            Hide
            Eloy Lafuente (stronk7) added a comment -

            And your fantastic code has met core, hope they become good friends for a long period.

            Closing, thanks!

            Show
            Eloy Lafuente (stronk7) added a comment - And your fantastic code has met core, hope they become good friends for a long period. Closing, thanks!

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved: