Fix TSRMLS_* and a few warnings