But it's the C-code that has the issue, not the PHP-code. You cannot _create_ these kinds of issues with PHP, but can certainly be affected by them. (With that said, PHP in particular is, in my own humble opinion, not really something you should ever use if you have an option. After following the development mailing list for years, I can honestly say it's the worst project I have ever seen from just about every perspective.)
If a common/basic library has an issue, then it typically affect you no matter what language you use to access it. Interpretation and/or code generation bugs can also affect just about anything you can think of, so there's no way out of that either. I think you should choose a platform with a good track record and a sane and security-aware design as opposed to something with a horrible track record and no security awareness what-so-ever. You won't be "safe", but you'll be better off.
I think we can all agree that "forget about even trying to write safe code, someone else has probably made a misstake anyway" is a very poor philosophy.