Merge pull request #6621 from stanley-cheung/php-tsrm-fix

Updated functions with TSRM macros for ZTS support