Jump to content

Invalid argument supplied


danielp1997

Recommended Posts

Hi

All of a sudden, a message has been appearing around the website:

Warning: Invalid argument supplied for foreach() in /en/core/common/PilotData.class.php on line 189

This is the piece of code that is causing the error, which is the same as I've always used and has never caused any problems:

$pilotid = PilotData::GetPilotCode(Auth::$userinfo->code, Auth::$userinfo->pilotid);
$id = PilotData::getProperPilotID($pilotid);

There has never been any problems with this and all of a sudden it just started.

Line 189 is "foreach($airlines as $a)" with the surrounding function - none of it has been modified.

/**
* Parse a pilot ID from a passed ID
*
* @param int $pilotid Pass the ID string
* @return int Returns the integer database ID
*
*/
public static function parsePilotID($pilotid)
{
if(!is_numeric($pilotid))
{
$airlines = OperationsData::getAllAirlines();
foreach($airlines as $a)
{
$a->code = strtoupper($a->code);

if(strpos($pilotid, $a->code) === false)
{
continue;
}


$pilotid = intval(str_ireplace($a->code, '', $pilotid));
$pilotid = $pilotid - Config::Get('PILOTID_OFFSET');
}
}

return $pilotid;
}

Your help is appreciated,

Thanks

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...