I didn't know that there are "illegal" formations in the firt place.

Isn't any formation allowed, as long as you have 11 players on the fiel and only one goal-keeper among them?