Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.9.11
    • Fix Version/s: None
    • Component/s: Module: HotPot
    • Labels:
      None
    • Database:
      MySQL
    • Affected Branches:
      MOODLE_19_STABLE
    • Rank:
      1014

      Description

      Non-latinic text in HotPot was spoiled after update to 1.9.3.
      In 1.8 all displyed correctly.

      1. ttt.jmt
        4 kB
        Alex Djachenko
      1. hotpot.png
        47 kB
      2. ttt.jmt.mdl.19.jpg
        31 kB

        Issue Links

          Activity

          Hide
          Gordon Bateson added a comment -

          Please could you attach the quiz that does not display correctly.

          Or if you are talking about a report, please could you attach a screenshot.

          Show
          Gordon Bateson added a comment - Please could you attach the quiz that does not display correctly. Or if you are talking about a report, please could you attach a screenshot.
          Hide
          Alex Djachenko added a comment -

          I'm talking about all hotpot files: HotPot save data as ISO ISO-8859-1 and other characters translate to "#x0423;ра".
          Previus version moodle translated it to UTF-8, but 1.9.3 doesn't.

          Show
          Alex Djachenko added a comment - I'm talking about all hotpot files: HotPot save data as ISO ISO-8859-1 and other characters translate to "#x0423;ра". Previus version moodle translated it to UTF-8, but 1.9.3 doesn't.
          Hide
          Gordon Bateson added a comment -

          Thanks for uploading the JMatch file.
          It displays fine on my Moodle 1.9 site (see attached screenshot)

          Please could you attach a screenshot of the problem you are seeing.

          Show
          Gordon Bateson added a comment - Thanks for uploading the JMatch file. It displays fine on my Moodle 1.9 site (see attached screenshot) Please could you attach a screenshot of the problem you are seeing.
          Hide
          Alex Djachenko added a comment -

          It's Moodle 1.9.3+ (checkout last week). In 1.9.2 all right.

          Show
          Alex Djachenko added a comment - It's Moodle 1.9.3+ (checkout last week). In 1.9.2 all right.
          Hide
          Gordon Bateson added a comment -

          Thanks for the screenshot.

          I have seen something like this caused by PHP 5.0.3:
          http://moodle.org/mod/forum/discuss.php?d=22034

          If you are are using PHP 5.0.3, you will have to upgrade PHP to fix this issue.

          Otherwise, please could you confirm what version of PHP and MySQL you are using.

          Show
          Gordon Bateson added a comment - Thanks for the screenshot. I have seen something like this caused by PHP 5.0.3: http://moodle.org/mod/forum/discuss.php?d=22034 If you are are using PHP 5.0.3, you will have to upgrade PHP to fix this issue. Otherwise, please could you confirm what version of PHP and MySQL you are using.
          Hide
          Gordon Bateson added a comment -

          I just updated to Moodle 1.9.3+ (20081106) and confirmed the ttt.jmt displays OK, that is to say the Russian chars appear as expected.

          Show
          Gordon Bateson added a comment - I just updated to Moodle 1.9.3+ (20081106) and confirmed the ttt.jmt displays OK, that is to say the Russian chars appear as expected.
          Hide
          Alex Djachenko added a comment -

          Moodle 1.9.3+ (Build: 20081105)
          There is promlem still
          /admin/environment.php shows all ok.

          Show
          Alex Djachenko added a comment - Moodle 1.9.3+ (Build: 20081105) There is promlem still /admin/environment.php shows all ok.
          Hide
          Gordon Bateson added a comment -

          Something is removing the "&" strings from the ttt.jmt file on your server.

          I am not able to reproduce this issue on the servers I have access to which run Moodle 1.9.3+.

          Would it be possible for me to have access to your server so the problem can be investigated further?

          Show
          Gordon Bateson added a comment - Something is removing the "&" strings from the ttt.jmt file on your server. I am not able to reproduce this issue on the servers I have access to which run Moodle 1.9.3+. Would it be possible for me to have access to your server so the problem can be investigated further?
          Hide
          Alex Djachenko added a comment -

          We have decided this problem:
          there is libxml2-2.7.2 on our server, but HotPot need to libxml2-2.6.32 for correct work.
          I think, it could be added to manual and enviroment test...

          Show
          Alex Djachenko added a comment - We have decided this problem: there is libxml2-2.7.2 on our server, but HotPot need to libxml2-2.6.32 for correct work. I think, it could be added to manual and enviroment test...
          Hide
          Gordon Bateson added a comment -

          Wow - that's great information. Thanks a lot !

          It seems libxml2.7.1 and libxml2.7.2 have a serious bug which strips out html entities from xml:

          PHP Bug #45996: libxml2 2.7.1 causes breakage with character data in xml_parse()
          http://bugs.php.net/bug.php?id=45996

          I note that this is fairly recent bug - first reported on 4th Sept 2008 - and that posts on how to fix it still continue - most recent post is dated 5th Nov 2008.

          Instructions on how to downgrade libxml are here:
          http://blog.code-head.com/fixing-libxml-php-bug-and-issues-with-html-entities-downgrading-libxml

          I will investigate how the Moodle environment checks could be modified to detect a viable version of libxml.

          Show
          Gordon Bateson added a comment - Wow - that's great information. Thanks a lot ! It seems libxml2.7.1 and libxml2.7.2 have a serious bug which strips out html entities from xml: PHP Bug #45996: libxml2 2.7.1 causes breakage with character data in xml_parse() http://bugs.php.net/bug.php?id=45996 I note that this is fairly recent bug - first reported on 4th Sept 2008 - and that posts on how to fix it still continue - most recent post is dated 5th Nov 2008. Instructions on how to downgrade libxml are here: http://blog.code-head.com/fixing-libxml-php-bug-and-issues-with-html-entities-downgrading-libxml I will investigate how the Moodle environment checks could be modified to detect a viable version of libxml.
          Hide
          Gordon Bateson added a comment -

          here is the code to detect the bad libxml2 extensions:

          $bad_libxml2 = false;
          if (extension_loaded('libxml')) {
          ob_start();
          phpinfo(INFO_MODULES);
          $pattern = '/<tr><td[^>]>libxml2[^<]<\/td><td[^>]>\s([0-9.]+)\s*<\/td><\/tr>/';
          if (preg_match($pattern, ob_get_clean(), $matches)) {
          if ($matches[1]=='2.7.1' || $matches[1]=='2.7.2')

          { $bad_libxml2 = true; }

          }
          }
          if ($bad_libxml2)

          { // libxml2 has PHP bug #45996 which corrupts non-latin chars encoded as HTML entities in xml // this messes up the display of quizzes by Moodle's HotPot module // http://tracker.moodle.org/browse/MDL-17136 // http://bugs.php.net/bug.php?id=45996 }
          Show
          Gordon Bateson added a comment - here is the code to detect the bad libxml2 extensions: $bad_libxml2 = false; if (extension_loaded('libxml')) { ob_start(); phpinfo(INFO_MODULES); $pattern = '/<tr><td [^>] >libxml2 [^<] <\/td><td [^>] >\s ( [0-9.] +)\s*<\/td><\/tr>/'; if (preg_match($pattern, ob_get_clean(), $matches)) { if ($matches [1] =='2.7.1' || $matches [1] =='2.7.2') { $bad_libxml2 = true; } } } if ($bad_libxml2) { // libxml2 has PHP bug #45996 which corrupts non-latin chars encoded as HTML entities in xml // this messes up the display of quizzes by Moodle's HotPot module // http://tracker.moodle.org/browse/MDL-17136 // http://bugs.php.net/bug.php?id=45996 }
          Hide
          Gordon Bateson added a comment -

          Eloy ,
          I have added you as a watcher to this issue, because I wondered if you could advise on how we might modify the environment checking to detect faulty versions of libxml2.

          Probably, we need to modify one of the following:

          • admin/environment.xml
          • admin/environment.php
          • lib/customcheckslib.php
          • lib/environmentlib.php

          But I do not have CVS access rights to modify any of those files.

          thanks in advance for any help
          Gordon

          Show
          Gordon Bateson added a comment - Eloy , I have added you as a watcher to this issue, because I wondered if you could advise on how we might modify the environment checking to detect faulty versions of libxml2. Probably, we need to modify one of the following: admin/environment.xml admin/environment.php lib/customcheckslib.php lib/environmentlib.php But I do not have CVS access rights to modify any of those files. thanks in advance for any help Gordon
          Hide
          Eloy Lafuente (stronk7) added a comment -

          Hi Gordon

          yes, that problem with libxml is an old "friend", . See MDL-16759.

          Perhaps, instead of looking for exact versions of libxml against the information given by phpinfo we could, simply, test the parser with a small XML file, containing both encoded HTML tags and some UTF-8 chars known to fail under buggy versions? If we read the XML and get wrong results... one message can be shown in the environment page, recommending to change libxml version or pointing to one page in Docs.

          I'm not able to run any buggy version of libxml here (Mac), but if you can and can provide the test... I'll add it as custom test in 19_STABLE and HEAD.

          Ciao

          Show
          Eloy Lafuente (stronk7) added a comment - Hi Gordon yes, that problem with libxml is an old "friend", . See MDL-16759 . Perhaps, instead of looking for exact versions of libxml against the information given by phpinfo we could, simply, test the parser with a small XML file, containing both encoded HTML tags and some UTF-8 chars known to fail under buggy versions? If we read the XML and get wrong results... one message can be shown in the environment page, recommending to change libxml version or pointing to one page in Docs. I'm not able to run any buggy version of libxml here (Mac), but if you can and can provide the test... I'll add it as custom test in 19_STABLE and HEAD. Ciao
          Hide
          Tim Hunt added a comment -

          Adjusting bogus fix version.

          Show
          Tim Hunt added a comment - Adjusting bogus fix version.
          Hide
          Gordon Bateson added a comment -

          Here is a candidate for a function to go in 'lib/customchecks.php". It should detect versions of the PHP xmllib which sliently remove ampersands from XML, thereby messing up Moodle's backups, restores and HotPot module.

          function php_check_libxml($result) {
          global $CFG;
          require_once($CFG->dirroot.'/lib/xmlize.php');

          $xml = xmlize('<?xml version="1.0" encoding="ISO-8859-1"?><amp>&</amp>', 0);
          if (isset($xml['amp']'#'['0']) && $xml['amp']'#'['0']=='&')

          { // xmlize works ok $result = null; }

          else {
          // bad libxml library
          $result->status = false;
          $result->badlibxml = '';
          if (extension_loaded('libxml')) {
          // try to get libxml2 version
          ob_start();
          phpinfo(INFO_MODULES);
          $pattern = '/<tr><td[^>]>libxml2[^<]<\/td><td[^>]>\s([0-9.]+)\s*<\/td><\/tr>/';
          if (preg_match($pattern, ob_get_clean(), $matches))

          { $result->badlibxml = $matches[1]; // 2.7.1 and 2.7.2 are known to be bad }

          }
          }
          return $result;
          }

          The function would be called by adding something like the following to "admin/environment.xml"

          <CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_xmllib" level="optional">
          <FEEDBACK>
          <ON_CHECK message="xmllibwarning" />
          </FEEDBACK>
          </CUSTOM_CHECK>

          And the following message to "lang/en_utf8/admin.php"

          $string['xmllibwarning'] = '<p><strong>Dysfunctional XML library</strong></p><p>PHP's xml library on this server is dysfunctional and will cause errors in Moodle's backups, restores and the HotPot module</p>';

          It may be possible to use the $result->badxmllib to report the xmllib version, but I can't see how to do that as quickly as I think you can

          regards
          Gordon

          Show
          Gordon Bateson added a comment - Here is a candidate for a function to go in 'lib/customchecks.php". It should detect versions of the PHP xmllib which sliently remove ampersands from XML, thereby messing up Moodle's backups, restores and HotPot module. function php_check_libxml($result) { global $CFG; require_once($CFG->dirroot.'/lib/xmlize.php'); $xml = xmlize('<?xml version="1.0" encoding="ISO-8859-1"?><amp>&</amp>', 0); if (isset($xml ['amp'] '#' ['0'] ) && $xml ['amp'] '#' ['0'] =='&') { // xmlize works ok $result = null; } else { // bad libxml library $result->status = false; $result->badlibxml = ''; if (extension_loaded('libxml')) { // try to get libxml2 version ob_start(); phpinfo(INFO_MODULES); $pattern = '/<tr><td [^>] >libxml2 [^<] <\/td><td [^>] >\s ( [0-9.] +)\s*<\/td><\/tr>/'; if (preg_match($pattern, ob_get_clean(), $matches)) { $result->badlibxml = $matches[1]; // 2.7.1 and 2.7.2 are known to be bad } } } return $result; } The function would be called by adding something like the following to "admin/environment.xml" <CUSTOM_CHECK file="lib/customcheckslib.php" function="php_check_xmllib" level="optional"> <FEEDBACK> <ON_CHECK message="xmllibwarning" /> </FEEDBACK> </CUSTOM_CHECK> And the following message to "lang/en_utf8/admin.php" $string ['xmllibwarning'] = '<p><strong>Dysfunctional XML library</strong></p><p>PHP's xml library on this server is dysfunctional and will cause errors in Moodle's backups, restores and the HotPot module</p>'; It may be possible to use the $result->badxmllib to report the xmllib version, but I can't see how to do that as quickly as I think you can regards Gordon
          Hide
          Dan Marsden added a comment -

          Thanks for adding a link to this from the PHP bug Gordon! - this libxml issue also affects Moodle Networking (Mnet)

          Show
          Dan Marsden added a comment - Thanks for adding a link to this from the PHP bug Gordon! - this libxml issue also affects Moodle Networking (Mnet)
          Hide
          Petr Škoda added a comment -

          we are getting very close to the release, moving target release, sorry

          Show
          Petr Škoda added a comment - we are getting very close to the release, moving target release, sorry

            People

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

              Dates

              • Created:
                Updated:

                Development