static void dom_register_prop_handler(HashTable *prop_handler, char *name, size_t name_len, dom_read_t read_func, dom_write_t write_func)
{
dom_prop_handler hnd;
+ zend_string *str;
hnd.read_func = read_func ? read_func : dom_read_na;
hnd.write_func = write_func ? write_func : dom_write_na;
- zend_hash_str_add_mem(prop_handler, name, name_len, &hnd, sizeof(dom_prop_handler));
+ str = zend_string_init_interned(name, name_len, 1);
+ zend_hash_add_mem(prop_handler, str, &hnd, sizeof(dom_prop_handler));
+ zend_string_release(str);
}
/* }}} */
void mysqli_add_property(HashTable *h, const char *pname, size_t pname_len, mysqli_read_t r_func, mysqli_write_t w_func) {
mysqli_prop_handler p;
- p.name = zend_string_init(pname, pname_len, 1);
+ p.name = zend_string_init_interned(pname, pname_len, 1);
p.read_func = (r_func) ? r_func : mysqli_read_na;
p.write_func = (w_func) ? w_func : mysqli_write_na;
zend_hash_add_mem(h, p.name, &p, sizeof(mysqli_prop_handler));
void php_snmp_add_property(HashTable *h, const char *name, size_t name_length, php_snmp_read_t read_func, php_snmp_write_t write_func)
{
php_snmp_prop_handler p;
+ zend_string *str;
p.name = (char*) name;
p.name_length = name_length;
p.read_func = (read_func) ? read_func : NULL;
p.write_func = (write_func) ? write_func : NULL;
- zend_hash_str_add_mem(h, (char *)name, name_length, &p, sizeof(php_snmp_prop_handler));
+ str = zend_string_init_interned(name, name_length, 1);
+ zend_hash_add_mem(h, str, &p, sizeof(php_snmp_prop_handler));
+ zend_string_release(str);
}
/* }}} */
static void xmlreader_register_prop_handler(HashTable *prop_handler, char *name, xmlreader_read_int_t read_int_func, xmlreader_read_const_char_t read_char_func, int rettype)
{
xmlreader_prop_handler hnd;
+ zend_string *str;
hnd.read_char_func = read_char_func;
hnd.read_int_func = read_int_func;
hnd.type = rettype;
- zend_hash_str_add_mem(prop_handler, name, strlen(name), &hnd, sizeof(xmlreader_prop_handler));
+ str = zend_string_init_interned(name, strlen(name), 1);
+ zend_hash_add_mem(prop_handler, str, &hnd, sizeof(xmlreader_prop_handler));
+ zend_string_release(str);
}
/* }}} */
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);
}
/* }}} */