Seems like an infringement of the free exercise of religion to me. On what basis does the State presume to make certain objects illegal in all Churches, regardless of whether any church wants such items banned?
There are well known religions for whom the carrying of a weapon is a religious obligation.
It is easy to imagine that a congregation in most any church might determine they want to allow or even encourage the possession of defensive weapons at their meetings. This law would prevent it? Clearly, and church that wanted to allow arms would be able to get such a law overturned fairly quickly.
At the very least, to withstand 1st amendment claims, such a law must allow churches to permit arms if they want to.
I believe a better policy is to permit arms, unless the church gives notice in some reasonable way that arms are banned.
Ideally, the law should not single out guns or any other prohibited item at a church for any special penalties. Let basic trespassing laws or even "hate crime" (if conduct is deliberate and targeted to harass, intimidate, etc) laws handle the rare cases of someone taking a gun into a church contrary to the church wishes. Ditto for someone who takes a ham sandwich into a synagogue or mosque, or alcohol into a mormon church, etc.