danielp1997 Posted September 21, 2015 Report Posted September 21, 2015 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 Quote
danielp1997 Posted September 21, 2015 Author Report Posted September 21, 2015 Nvm, fixed it, removed the stuff I didn't need from the function. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.