Moodle
  1. Moodle
  2. MDL-27515

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

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor 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
    • Rank:
      17179

      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.

        Activity

        Hide
        Konrad Lorinczi added a comment -

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

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

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

        Show
        Michael de Raadt added a comment - This is probably an easy fix, but it's not a blocker in terms of release.
        Hide
        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
        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
        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
        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
        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
        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
        Eloy Lafuente (stronk7) added a comment -

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

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

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

        Show
        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: