summaryrefslogtreecommitdiff
path: root/ext/zip/php_zip.c
diff options
context:
space:
mode:
authorXinchen Hui <laruence@gmail.com>2017-11-02 10:40:45 +0800
committerXinchen Hui <laruence@gmail.com>2017-11-02 10:40:45 +0800
commit39845250f242b7739d30b4b8a287b4a6130d8fa1 (patch)
tree3f8f69284a99f7932989f2460e8d78d1757a34cf /ext/zip/php_zip.c
parenta32e567ec8b28a7ccc0ebca9d24911788aaf853c (diff)
parenta7305eb539596e175bd6c3ae9a20953358c5d677 (diff)
downloadphp-git-39845250f242b7739d30b4b8a287b4a6130d8fa1.tar.gz
Merge branch 'master' of git.php.net:/php-src
* 'master' of git.php.net:/php-src: Made "result", "statement" and "last_message" to always use Zend MM heap. (even for persistent connections these entities don't relive request boundary) Fixed memory leaks Use interned strings for "magic" property of internal classes. (not copyied into SHM) Reverted incomplete fix and too strict asserts. Mark persistent connection related data as "thread-local". Persistent resources are "thread-local". Register persistent resources through new functions zend_register_persistent_resource()/zend_register_persistent_resource_ex(). PCRE cache is "thread-local" Allow reference-counting on "thread-local" persistent zvals
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r--ext/zip/php_zip.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index d50c735845..b5df2481e5 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -800,15 +800,20 @@ typedef struct _zip_prop_handler {
static void php_zip_register_prop_handler(HashTable *prop_handler, char *name, zip_read_int_t read_int_func, zip_read_const_char_t read_char_func, zip_read_const_char_from_ze_t read_char_from_obj_func, int rettype) /* {{{ */
{
zip_prop_handler hnd;
+ zend_string *str;
+ zval tmp;
hnd.read_const_char_func = read_char_func;
hnd.read_int_func = read_int_func;
hnd.read_const_char_from_obj_func = read_char_from_obj_func;
hnd.type = rettype;
- zend_hash_str_add_mem(prop_handler, name, strlen(name), &hnd, sizeof(zip_prop_handler));
+ str = zend_string_init_interned(name, strlen(name), 1);
+ zend_hash_add_mem(prop_handler, str, &hnd, sizeof(zip_prop_handler));
/* Register for reflection */
- zend_declare_property_null(zip_class_entry, name, strlen(name), ZEND_ACC_PUBLIC);
+ ZVAL_NULL(&tmp);
+ zend_declare_property_ex(zip_class_entry, str, &tmp, ZEND_ACC_PUBLIC, NULL);
+ zend_string_release(str);
}
/* }}} */