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

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

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • 1.9.9
    • 1.9.13
    • Course, Resource
    • 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.

      Attachments

        Activity

          People

            rwijaya Rossiani Wijaya
            klor Konrad Lorinczi
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
            Amaia Anabitarte, Carlos Escobedo, Ferran Recio, Ilya Tregubov, Laurent David, Raquel Ortega, Sara Arjona (@sarjona), Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Sujith Haridasan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              1/Aug/11