Add missing TSRMLS for PHP 5.6

There were some ABI changes in PHP 5.6 (TSRMLS_FETCH crusade). This patch adds some ifdefs to fix compilation errors on PHP 5.6 and master