TSRM/ZTS fixes.

This fixes the build with ZTS enabled and mutex initialization which made all executeString calls just hang

The test suite passes only partially since some single ZVALs are leaked (which cause notices and hence differences from expected console output)