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

getremoteconfaddr cannot be set to HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.5.14, 3.7.8, 3.8.5, 3.9.2
    • Fix Version/s: 3.9.5, 3.10.2
    • Component/s: Installation
    • Labels:

      Description

      A change in defaults set with MDL-69074 means it is now impossible to set CFG->getremoteaddrconf to HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR (value: 0).

       

      MDL-69074 did this:

          if (empty($CFG->getremoteaddrconf)) {
               // This will happen, for example, before just after the upgrade, as the
               // user is redirected to the admin screen.
      -        $variablestoskip = 0;
      +        $variablestoskip = GETREMOTEADDR_SKIP_DEFAULT;
           } else {
               $variablestoskip = $CFG->getremoteaddrconf;
           }
      

      The problem is "0", which is used by "HTTP_CLIENT_IP, HTTP_X_FORWARDED_FOR, REMOTE_ADDR" equates to empty - and the empty branch of the IF no longer sets the value to 0.

      We should change `if (empty(...` to `if (!isset(...` - which allows the UI/config.php to set the value to '0'.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dvdcastro David Castro
              Reporter:
              aolley Adam Olley
              Peer reviewer:
              Jordan Tomkinson
              Integrator:
              Eloy Lafuente (stronk7)
              Tester:
              CiBoT
              Participants:
              Component watchers:
              Matteo Scaramuccia, Andrew Nicols, Dongsheng Cai, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze
              Votes:
              11 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                8/Mar/21

                  Time Tracking

                  Estimated:
                  Original Estimate - 0 minutes
                  0m
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 hour, 2 minutes
                  1h 2m