• Resolved Dittiox

    (@dittiox)


    Hello,

    The new version (2.1.2) returns an error for invalid arguments supplied for foreach in ApiClient.php when a server has no players online or no plugins.

    All you have to do is add a check whether the arrays used in the foreach statements on line 92 and 99 are empty or not.

    For example:

    foreach ($data['players'] as $player) {
                $players_new[] = array('name' => $player);
            }

    becomes

    if (is_array($data['players'])){
            foreach ($data['players'] as $player) {
                $players_new[] = array('name' => $player);
            }
     }

    And the same goes for the foreach() on line 99

    http://wordpress.org/plugins/minestatus/

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘2.1.2 doesn't check whether arrays are empty or not.’ is closed to new replies.