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

remove deprecated each() from mnet xmlrpc code

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • 4.0
    • MNet
    • None

      There's one call to each() in the mnet source files:

      mnet/xmlrpc/serverlib.php
      -----------------------------------------------------------------------------------------
      FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE
      -----------------------------------------------------------------------------------------
       533 | WARNING | Function each() is deprecated since PHP 7.2; Use a foreach loop instead
      -----------------------------------------------------------------------------------------

      The affected function:

      function mnet_keyswap($function, $params) {
          global $CFG;
          $return = array();
          $mnet = get_mnet_environment();
          if (!empty($CFG->mnet_register_allhosts)) {
              $mnet_peer = new mnet_peer();
              @list($wwwroot, $pubkey, $application) = each($params);
              $keyok = $mnet_peer->bootstrap($wwwroot, $pubkey, $application);
              if ($keyok) {
                  $mnet_peer->commit();
              }
          }
          return $mnet->public_key;
      }
      

      Since it is a simple case of array destructuring the fix is rather easy to just remove each().

       

      The file mnet/xmlrpc/serverlib.php is also missing a license header!? The commits de260e0f7bed431d9584538f3c646db2a5577879 and d2ac37c1ab6247f327c4e764692eff78004f2c6e moved a lot of code from mnet/xmlrpc/server.php to mnet/xmlrpc/serverlib.php and there was no license header added.

            Daniel Ziegenberg Daniel Ziegenberg
            Daniel Ziegenberg Daniel Ziegenberg
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.