I heard that when you have an ear infection the eardrum can burst. Is it true or common to happen?

Possible. Long before there were antibiotics ear infections commonly resolved with the ear drum bursting and the healing. In acute ear infection, withain and hearing loss, treatment with oral antibiotics, usually clears infection before ear drum would perforate or burst.
Rare but can happen. It is rare but it can happen. Sometimes with an ear infection the pus inside the middle ear causes the drum to thin in certain places. The pressure can become so great that the drum bursts. Before antibiotics this bursting was actually a good thing because the pus would drain and the ear improve.