BOSTON - Gov. Deval L. Patrick has signed a bill designed to close some of the most egregious loopholes in the state's pension system.

The new law bans the use of housing benefits, car-related costs and other bonuses to inflate pensions. It instead limits the definition of "compensation" to wages and salary.

It also ends the "termination allowance" for lawmakers who were not re-elected and eliminates the "one-day/one-year" rule allowing elected officials to be credited with a year's service for just one day's work in a calendar year.

The changes apply to both current and future state workers.

Patrick said he's confident the new law, which won bipartisan support in the House and Senate, could withstand legal challenges.