-
Bug
-
Resolution: Duplicate
-
Minor
-
None
-
4.0
-
None
-
MOODLE_400_STABLE
-
MDL-73522_remove-deprecated-each-from-mnet-xmlrpc-code
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.
- duplicates
-
MDL-73514 MNet "register all hosts" not working - and remove remaining each() use
-
- Closed
-