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

Default value for empty fields in Oracle breaks default interactive enrolment (and maybe other places)

    XMLWordPrintable

    Details

    • Database:
      Oracle
    • Affected Branches:
      MOODLE_17_STABLE
    • Fixed Branches:
      MOODLE_17_STABLE, MOODLE_18_STABLE

      Description

      From .../lib/xmldb/classes/generators/oci8po/oci9po.class.php:

      // To define the default to set for NOT NULLs CHARs without default (null=do nothing)
      // Using this whitespace here because Oracle doesn't distinguish empty and null!

      This means courses get a default value for the (interactive) enrolment plugin that is a white space, and not and empty string, when we use the 'Site Default' option. Later, in .../enrol/enrol.class.php we do:

      function factory($enrol = '') {
      global $CFG;
      if (!$enrol)

      { $enrol = $CFG->enrol; }

      So we test whether $enrol is empty or not, to use the default interactive enrolment plugin. But this breaks with Oracle, as $enrol is not empty but has a single white space character. So we end up using an enrolment plugin called ' ', which doesn't exist and generates a run-time error when we do the require_once() a few lines below.

      I'd have a cursory look, and I'd say there are other places where such assuption is made (emtpy field === default value), which totally breaks when using Oracle.

      (I'd like to thank Mikel Kortabarria, our local Oracle guru, for tracking down this bug .

      Saludos. Iñaki.

        Attachments

        1. 10000mssql.html
          0.4 kB
        2. 10000mysql.html
          0.4 kB
        3. 10000postgres.html
          0.4 kB
        4. 50000mysql_lessfields.html
          0.4 kB
        5. 50000mysql.html
          0.4 kB
        6. 50000postgres_lessfields.html
          0.4 kB
        7. 50000postgres.html
          0.4 kB
        8. rs_fetch_mssql.html
          0.5 kB
        9. rs_fetch_mysql.html
          0.5 kB
        10. rs_fetch_postgresh.html
          0.5 kB
        11. rstest.php
          3 kB
        12. rstest2.php
          4 kB

          Issue Links

            Activity

              People

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

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Fix Release Date:
                  30/Mar/07