He was released by Bolton last month, three years after signing for the Trotters from Leeds United.
At Fulham Lonergan would become the third former Leeds player, joining Ross McCormack and Matt Smith.
The goalkeeper captained Leeds after Jonny Howson was sold, but lost his place to Paddy Kenny under the management of Neil Warnock.
He played 32 times for Bolton last season, keeping out new Liverpool addition Adam Bogdan. Bolton last week signed released Manchester United goalkeeper and England under-21 international Ben Amos.
Lonergan, 31, represented both Ireland and England at youth level, but was never capped by either's senior side.
The Huddersfield Examiner had reported at the end of last month that Lonergan was a potential target for Nottingham Forest, who are in the market for a new stopper with Karl Darlow linking up with Newcastle.
Fulham themselves need cover in goal having released Hungarian goalkeeper Gabor Kiraly, formerly of Crystal Palace, and Dutchman Maaren Stekelenburg is expected to be sold after a successful season on loan at Monaco, and getting in experienced stopper Lonergan would fit the bill.