Oh, I am definitely not the person to ask on that. I’m very noobish when it comes to php.
If I had to guess. It might be something inside the wordpress code that is conflicting with it. They have a lot going on in those files to make things work. Lots of stuff it could conflict with. Someone else with more php knowledge would know better than I.