The library is C's fault. PHP is basically a scripting language around the standard C library. It's what makes it the fastest non-JIT scripting language, but also what makes it so inconsistent.
It's not really a matter of fault. If being a wrapper around C is a problem, it's a problem PHP designers made, for better or worse. That's not C's fault.