GitHub user zhaakhi opened a pull request: https://github.com/apache/thrift/pull/1152
THRIFT-3984 PHP7 extension causes segfault Fix a double-free when serializing string map keys or the name of called methods, and a memory leak when deserializing maps or sets. You can merge this pull request into a Git repository by running: $ git pull https://github.com/zhaakhi/thrift THRIFT-3984 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/thrift/pull/1152.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1152 ---- commit d956e2fc998ff4cee463b5ef39758b3cbe4d635e Author: HÃ¥kon Hitland <hakon.hitl...@zedge.net> Date: 2016-12-05T17:42:41Z THRIFT-3984 PHP7 extension causes segfault The PHP 7 extension can sometimes free strings it does not own, when serializing string map keys, or the name of called methods. The latter case was somewhat migitated since the double-free has no effect on interned strings. Using ZVAL_STR_COPY instead of ZVAL_STR will increment the reference count, making the following destructor call correct. commit e4b6425086938ab42f7d097324dea9c2136dbcba Author: HÃ¥kon Hitland <hakon.hitl...@zedge.net> Date: 2016-12-05T20:08:19Z Fix memory leak in PHP 7 Fix memory leak when deserializing maps or sets. zend_hash_update will add its own reference to the key, so we need to destruct the key zval to not leak. We don't need to destruct the value, the hash table will take ownership of it. ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---