Don't use TSRMLS_CC for zend_copy_string()
Cleaned up the cast logic