Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-27515

BUG in /mod/resource/mod_form.php - require fails in loop

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.9
    • Fix Version/s: 1.9.13
    • Component/s: Course, Resource
    • Labels:
    • Environment:
      Moodle 1.9.9 (Build: 20100609), Debian Linux, Apache
      Apache/2.2.9 (Debian) mod_jk/1.2.26 PHP/5.2.6-1+lenny9 with Suhosin-Patch proxy_html/3.0.0 mod_ssl/2.2.9 OpenSSL/0.9.8g Server at 172.17.1.27 Port 80

      Description

      Moodle 1.9.9 (Build: 20100609)
      Developing an import script, which imports courses into Moodle from a database of a custom software.
      I import and create courses, then doing the following for each course:

      • adding forum module,
      • adding chat module,
      • adding resource (file subtype, used for creating http link) module,
      • setting a description to section 0 of each course

      Creating of courses are done in a loop, and everything works fine, if just one loop is done.
      When doing multiple loops, the execution stopped when /moodle/mod/resource/mod_form.php was executed 2nd time, only one full loop was executed, 2nd loop was stopped.

      I tracked down the bug and found, that execution stops at /moodle/mod/resource/mod_form.php line 25
      when "resource.class.php" is required.

      After changing required to required_once , the loops did not stop at mod_form.php line 25, and all loops was executed, successfully.

      BUGFIX in
      /moodle/mod/resource/mod_form.php
      line 25
      require($CFG->dirroot.'/mod/resource/type/'.$type.'/resource.class.php');
      change to
      require_once($CFG->dirroot.'/mod/resource/type/'.$type.'/resource.class.php');

      Please include this BUGFIX into

      • Moodle v1.9.13
        and
      • Moodle 2.0.4

      Thanks in advance.

        Gliffy Diagrams

          Activity

          Hide
          klor Konrad Lorinczi added a comment -

          Setting Priority to blocker, as it Blocks development and/or testing work.

          Show
          klor Konrad Lorinczi added a comment - Setting Priority to blocker, as it Blocks development and/or testing work.
          Hide
          salvetore Michael de Raadt added a comment -

          This is probably an easy fix, but it's not a blocker in terms of release.

          Show
          salvetore Michael de Raadt added a comment - This is probably an easy fix, but it's not a blocker in terms of release.
          Hide
          rwijaya Rossiani Wijaya added a comment -

          Thanks Konrad for reporting.

          The require line only occurs in 1.9 and not in 2.0.4

          This issue doesn't need to be peer review.

          Submitting this for integration

          Show
          rwijaya Rossiani Wijaya added a comment - Thanks Konrad for reporting. The require line only occurs in 1.9 and not in 2.0.4 This issue doesn't need to be peer review. Submitting this for integration
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week.

          TIA and ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - The main moodle.git repository has just been updated with latest weekly modifications. You may wish to rebase your PULL branches to simplify history and avoid any possible merge conflicts. This would also make integrator's life easier next week. TIA and ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          Not sure why one browser script like mod_form.php should be used by external importers at all... but integrating it anyway (19_STABLE only).

          Ciao

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - Not sure why one browser script like mod_form.php should be used by external importers at all... but integrating it anyway (19_STABLE only). Ciao
          Hide
          stronk7 Eloy Lafuente (stronk7) added a comment -

          This does not need further testing. Straight passing under my responsibility.

          Show
          stronk7 Eloy Lafuente (stronk7) added a comment - This does not need further testing. Straight passing under my responsibility.
          Hide
          samhemelryk Sam Hemelryk added a comment -

          Congratulations - this fix has just been released in the weeklies.

          Show
          samhemelryk Sam Hemelryk added a comment - Congratulations - this fix has just been released in the weeklies.

            People

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

              Dates

              • Created:
                Updated:
                Resolved:
                Fix Release Date:
                1/Aug/11