Moodle
  1. Moodle
  2. MDL-25755

ldap enrol.php contains reserved oracle keyword in sql

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.9.10
    • Fix Version/s: 1.9.11
    • Component/s: Enrolments
    • Labels:
    • Environment:
      SLES 11 SP1, Oracle 11i
    • Database:
      Oracle
    • Difficulty:
      Easy
    • Affected Branches:
      MOODLE_19_STABLE
    • Fixed Branches:
      MOODLE_19_STABLE
    • Rank:
      15456

      Description

      /enrol/ldap/enrol.php contains sql which has an Oracle reserved keyword ("...as user,1") in it, so the sql doesn't execute. (the error message is about "from" not being where it's expected. when you try to execute the select statement in PL/SQL Developer, it underlines the word "user" in the part about ...as user, telling you that it's a reserved keyword.)

        Activity

        Hide
        Chris Myers added a comment -

        If you look at the enrol.php file, around line 250, you'll see:

        $sql = '
        SELECT enr.userid as user, 1
        FROM '.$CFG->prefix.'role_assignments enr
        JOIN '.$CFG->prefix.'user usr ON usr.id=enr.userid
        WHERE enr.roleid = '.$role->id.'
        AND enr.contextid = '.$context->id.'
        AND enr.enrol = \'ldap\' ';

        and around line 264:
        $member = $member->user;

        If you change the "user" to like "muser" on both of these cases, it seems to resolve the issue.

        Show
        Chris Myers added a comment - If you look at the enrol.php file, around line 250, you'll see: $sql = ' SELECT enr.userid as user, 1 FROM '.$CFG->prefix.'role_assignments enr JOIN '.$CFG->prefix.'user usr ON usr.id=enr.userid WHERE enr.roleid = '.$role->id.' AND enr.contextid = '.$context->id.' AND enr.enrol = \'ldap\' '; and around line 264: $member = $member->user; If you change the "user" to like "muser" on both of these cases, it seems to resolve the issue.
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Done, I've submitted the fix to PULL-45 and hopefully will be approved/tested soon so, next Wednesday weekly build will include it.

        Thanks a lot for the report & research! Ciao

        PS: I've checked also that Moodle 2.0 hasn't this problem.

        Show
        Eloy Lafuente (stronk7) added a comment - Done, I've submitted the fix to PULL-45 and hopefully will be approved/tested soon so, next Wednesday weekly build will include it. Thanks a lot for the report & research! Ciao PS: I've checked also that Moodle 2.0 hasn't this problem.

          People

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

            Dates

            • Created:
              Updated:
              Resolved: