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

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 3.5.14, 3.7.8, 3.8.5, 3.9.2
    • 3.9.5, 3.10.2
    • Installation

    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

              dvdcastro David Castro
              aolley Adam Olley
              Jordan Tomkinson Jordan Tomkinson
              Eloy Lafuente (stronk7) Eloy Lafuente (stronk7)
              CiBoT CiBoT
              Matteo Scaramuccia, Andrew Lyons, Huong Nguyen, Jun Pataleta, Michael Hawkins, Shamim Rezaie, Simey Lameze, Stevani Andolo
              Votes:
              11 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                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