From a56d0af6950670f18b75fb71967d11d53a909657 Mon Sep 17 00:00:00 2001 From: yuqing Date: Tue, 2 Aug 2016 09:44:41 +0800 Subject: [PATCH] correct zend_hash_find_wrapper for php7 --- src/php7_ext_wrapper.h | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/php7_ext_wrapper.h b/src/php7_ext_wrapper.h index 733cadc..bc85ed7 100644 --- a/src/php7_ext_wrapper.h +++ b/src/php7_ext_wrapper.h @@ -171,9 +171,12 @@ typedef size_t zend_size_t; static inline int zend_hash_find_wrapper(HashTable *ht, char *key, int key_len, zval **value) { - zval zkey; - ZVAL_STRINGL(&zkey, key, key_len - 1); - *value = zend_hash_find(ht, Z_STR(zkey)); + zend_string *zkey; + bool use_heap; + + ZSTR_ALLOCA_INIT(zkey, key, key_len - 1, use_heap); + *value = zend_hash_find(ht, zkey); + ZSTR_ALLOCA_FREE(zkey, use_heap); return (*value != NULL ? SUCCESS : FAILURE); }