Well, dolls can't trap spirits because dolls, as inanimate objects, do not have free will or power over higher energy beings. But I think you mean that spirits can get stuck in objects, including dolls. True.
Inanimate objects are made from the same cosmic matter that we are but they lack life energy, which is a very big deal. So, objects can absorb energies--positive or negative--from whatever goes on around them. And sometimes, errant spirits just get stuck in objects because of their attraction to it and their limiting beliefs.
Objects can be imbued with energies by their creators' intentions, too.
But for the sake of this conversation, a doll is a doll is a doll. We infuse, transfer or transmit energies to it with our intentions, fears, beliefs, etc. And spirits can do the same with it.
Don't fear the doll.