PHP_HTTP_API const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len)
{
zval **cookie = NULL;
- if ((SUCCESS != zend_hash_find(&list->cookies, name, name_len + 1, (void *) &cookie)) || (Z_TYPE_PP(cookie) != IS_STRING)) {
+ if ((SUCCESS != zend_symtable_find(&list->cookies, name, name_len + 1, (void *) &cookie)) || (Z_TYPE_PP(cookie) != IS_STRING)) {
return NULL;
}
return Z_STRVAL_PP(cookie);
PHP_HTTP_API const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len)
{
zval **extra = NULL;
- if ((SUCCESS != zend_hash_find(&list->extras, name, name_len + 1, (void *) &extra)) || (Z_TYPE_PP(extra) != IS_STRING)) {
+ if ((SUCCESS != zend_symtable_find(&list->extras, name, name_len + 1, (void *) &extra)) || (Z_TYPE_PP(extra) != IS_STRING)) {
return NULL;
}
return Z_STRVAL_PP(extra);
MAKE_STD_ZVAL(cookie_value);
ZVAL_STRINGL(cookie_value, estrndup(value, value_len), value_len, 0);
- zend_hash_update(&list->cookies, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
+ zend_symtable_update(&list->cookies, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
}
MAKE_STD_ZVAL(cookie_value);
ZVAL_STRINGL(cookie_value, estrndup(value, value_len), value_len, 0);
- zend_hash_update(&list->extras, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
+ zend_symtable_update(&list->extras, name, name_len + 1, (void *) &cookie_value, sizeof(zval *), NULL);
}
if (!obj->list) {
obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
}
- if (SUCCESS == zend_hash_find(&obj->list->cookies, name_str, name_len + 1, (void *) &zvalue)) {
+ if (SUCCESS == zend_symtable_find(&obj->list->cookies, name_str, name_len + 1, (void *) &zvalue)) {
RETURN_ZVAL(*zvalue, 1, 0);
}
}
obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
}
if (!value_str) {
- zend_hash_del(&obj->list->cookies, name_str, name_len + 1);
+ zend_symtable_del(&obj->list->cookies, name_str, name_len + 1);
} else {
zval *zvalue;
MAKE_STD_ZVAL(zvalue);
ZVAL_STRINGL(zvalue, value_str, value_len, 1);
- zend_hash_update(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+ zend_symtable_update(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
}
}
RETVAL_ZVAL(getThis(), 1, 0);
}
MAKE_STD_ZVAL(zvalue);
ZVAL_STRINGL(zvalue, value_str, value_len, 1);
- zend_hash_add(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+ zend_symtable_update(&obj->list->cookies, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
}
RETVAL_ZVAL(getThis(), 1, 0);
}
if (!obj->list) {
obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
}
- if (SUCCESS == zend_hash_find(&obj->list->extras, name_str, name_len + 1, (void *) &zvalue)) {
+ if (SUCCESS == zend_symtable_find(&obj->list->extras, name_str, name_len + 1, (void *) &zvalue)) {
RETURN_ZVAL(*zvalue, 1, 0);
}
}
obj->list = php_http_cookie_list_init(NULL TSRMLS_CC);
}
if (!value_str) {
- zend_hash_del(&obj->list->extras, name_str, name_len + 1);
+ zend_symtable_del(&obj->list->extras, name_str, name_len + 1);
} else {
zval *zvalue;
MAKE_STD_ZVAL(zvalue);
ZVAL_STRINGL(zvalue, value_str, value_len, 1);
- zend_hash_update(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+ zend_symtable_update(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
}
}
RETVAL_ZVAL(getThis(), 1, 0);
}
MAKE_STD_ZVAL(zvalue);
ZVAL_STRINGL(zvalue, value_str, value_len, 1);
- zend_hash_add(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
+ zend_symtable_update(&obj->list->extras, name_str, name_len + 1, &zvalue, sizeof(zval *), NULL);
}
RETVAL_ZVAL(getThis(), 1, 0);
}
PHP_HTTP_API void php_http_cookie_list_dtor(php_http_cookie_list_t *list);
PHP_HTTP_API void php_http_cookie_list_free(php_http_cookie_list_t **list);
-#define php_http_cookie_list_has_cookie(list, name, name_len) zend_hash_exists(&(list)->cookies, (name), (name_len)+1)
+#define php_http_cookie_list_has_cookie(list, name, name_len) zend_symtable_exists(&(list)->cookies, (name), (name_len)+1)
PHP_HTTP_API void php_http_cookie_list_add_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len);
PHP_HTTP_API const char *php_http_cookie_list_get_cookie(php_http_cookie_list_t *list, const char *name, size_t name_len);
-#define php_http_cookie_list_has_extra(list, name, name_len) zend_hash_exists(&(list)->extras, (name), (name_len)+1)
+#define php_http_cookie_list_has_extra(list, name, name_len) zend_symtable_exists(&(list)->extras, (name), (name_len)+1)
PHP_HTTP_API void php_http_cookie_list_add_extra(php_http_cookie_list_t *list, const char *name, size_t name_len, const char *value, size_t value_len);
PHP_HTTP_API const char *php_http_cookie_list_get_extra(php_http_cookie_list_t *list, const char *name, size_t name_len);
zend_hash_get_current_data_ex(Z_ARRVAL_PP(hsv), (void *) &header, &pos);
Z_ADDREF_P(*header);
- zend_hash_add(PHP_HTTP_G->env.request.headers, key.str, key.len, (void *) header, sizeof(zval *), NULL);
+ zend_symtable_update(PHP_HTTP_G->env.request.headers, key.str, key.len, (void *) header, sizeof(zval *), NULL);
efree(key.str);
}
php_http_env_get_request_headers(NULL TSRMLS_CC);
- if (SUCCESS == zend_hash_find(PHP_HTTP_G->env.request.headers, key, name_len + 1, (void *) &zvalue)) {
+ if (SUCCESS == zend_symtable_find(PHP_HTTP_G->env.request.headers, key, name_len + 1, (void *) &zvalue)) {
zval *zcopy = php_http_ztyp(IS_STRING, *zvalue);
val = estrndup(Z_STRVAL_P(zcopy), Z_STRLEN_P(zcopy));
int got;
php_http_env_get_request_headers(NULL TSRMLS_CC);
- got = zend_hash_exists(PHP_HTTP_G->env.request.headers, key, name_len + 1);
+ got = zend_symtable_exists(PHP_HTTP_G->env.request.headers, key, name_len + 1);
efree(key);
return got;
if ((SUCCESS != zend_hash_find(&EG(symbol_table), ZEND_STRS("_SERVER"), (void *) &hsv)) || (Z_TYPE_PP(hsv) != IS_ARRAY)) {
return NULL;
}
- if ((SUCCESS != zend_hash_find(Z_ARRVAL_PP(hsv), key, key_len + 1, (void *) &var))) {
+ if ((SUCCESS != zend_symtable_find(Z_ARRVAL_PP(hsv), key, key_len + 1, (void *) &var))) {
return NULL;
}
if (check && !((Z_TYPE_PP(var) == IS_STRING) && Z_STRVAL_PP(var) && Z_STRLEN_PP(var))) {
zval **zvalue;
char *key = php_http_pretty_key(estrndup(name_str, name_len), name_len, 1, 1);
- if (SUCCESS == zend_hash_find(&headers, key, name_len + 1, (void *) &zvalue)) {
+ if (SUCCESS == zend_symtable_find(&headers, key, name_len + 1, (void *) &zvalue)) {
zval *zcopy = php_http_ztyp(IS_STRING, *zvalue);
val = estrndup(Z_STRVAL_P(zcopy), Z_STRLEN_P(zcopy));
val = zend_read_property(Z_OBJCE_P(options), options, name, name_len, 0 TSRMLS_CC);
efree(name);
} else {
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(options), name_str, name_len + 1, (void *) &valptr)) {
+ if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(options), name_str, name_len + 1, (void *) &valptr)) {
val = *valptr;
} else {
val = NULL;
INIT_PZVAL_ARRAY(&array, headers);
php_http_pretty_key(parser->_key.str, parser->_key.len, 1, 1);
- if (SUCCESS == zend_hash_find(headers, parser->_key.str, parser->_key.len + 1, (void *) &exist)) {
+ if (SUCCESS == zend_symtable_find(headers, parser->_key.str, parser->_key.len + 1, (void *) &exist)) {
convert_to_array(*exist);
add_next_index_stringl(*exist, parser->_val.str, parser->_val.len, 0);
} else {
zval *ret = NULL, **header;
char *key = php_http_pretty_key(estrndup(key_str, key_len), key_len, 1, 1);
- if (SUCCESS == zend_hash_find(&msg->hdrs, key, key_len + 1, (void *) &header)) {
+ if (SUCCESS == zend_symtable_find(&msg->hdrs, key, key_len + 1, (void *) &header)) {
if (join && Z_TYPE_PP(header) == IS_ARRAY) {
zval *header_str, **val;
HashPosition pos;
}
if (!zvalue) {
- zend_hash_del(&obj->message->hdrs, name, name_len + 1);
+ zend_symtable_del(&obj->message->hdrs, name, name_len + 1);
} else {
Z_ADDREF_P(zvalue);
- zend_hash_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
+ zend_symtable_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
}
efree(name);
}
convert_to_array(header);
zend_hash_next_index_insert(Z_ARRVAL_P(header), &zvalue, sizeof(void *), NULL);
} else {
- zend_hash_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
+ zend_symtable_update(&obj->message->hdrs, name, name_len + 1, &zvalue, sizeof(void *), NULL);
}
efree(name);
}
}
add_next_index_zval(*data, *value);
} else if (key) {
- zend_hash_add(dst, key, hash_key->nKeyLength, value, sizeof(zval *), NULL);
+ zend_symtable_update(dst, key, hash_key->nKeyLength, value, sizeof(zval *), NULL);
} else {
zend_hash_quick_add(dst, hash_key->arKey, hash_key->nKeyLength, hash_key->h, value, sizeof(zval *), NULL);
}
if ((selected = neg(identifier, &quality, supported TSRMLS_CC))) {
/* don't overwrite previously set with higher quality */
- if (!zend_hash_exists(Z_ARRVAL(array), selected, strlen(selected) + 1)) {
+ if (!zend_symtable_exists(Z_ARRVAL(array), selected, strlen(selected) + 1)) {
add_assoc_double(&array, selected, quality);
}
}
{
php_http_persistent_handle_list_t **list, *new_list;
- if (SUCCESS == zend_hash_find(&provider->list.free, ident_str, ident_len + 1, (void *) &list)) {
+ if (SUCCESS == zend_symtable_find(&provider->list.free, ident_str, ident_len + 1, (void *) &list)) {
#if PHP_HTTP_DEBUG_PHANDLES
fprintf(stderr, "LSTFIND: %p\n", *list);
#endif
}
if ((new_list = php_http_persistent_handle_list_init(NULL))) {
- if (SUCCESS == zend_hash_add(&provider->list.free, ident_str, ident_len + 1, (void *) &new_list, sizeof(php_http_persistent_handle_list_t *), (void *) &list)) {
+ if (SUCCESS == zend_symtable_update(&provider->list.free, ident_str, ident_len + 1, (void *) &new_list, sizeof(php_http_persistent_handle_list_t *), (void *) &list)) {
#if PHP_HTTP_DEBUG_PHANDLES
fprintf(stderr, "LSTFIND: %p (new)\n", *list);
#endif
fprintf(stderr, "PROVIDE: %s\n", name_str);
#endif
- if (SUCCESS == zend_hash_add(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider, sizeof(php_http_persistent_handle_provider_t), NULL)) {
+ if (SUCCESS == zend_symtable_update(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider, sizeof(php_http_persistent_handle_provider_t), NULL)) {
status = SUCCESS;
} else {
php_http_resource_factory_dtor(&provider.rf);
memset(a, 0, sizeof(*a));
LOCK();
- status = zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &a->provider);
+ status = zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &a->provider);
UNLOCK();
if (SUCCESS == status) {
*handle = NULL;
LOCK();
- if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
+ if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
status = php_http_persistent_handle_do_acquire(provider, ident_str, ident_len, handle TSRMLS_CC);
}
UNLOCK();
#endif
LOCK();
- if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
+ if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
status = php_http_persistent_handle_do_release(provider, ident_str, ident_len, handle TSRMLS_CC);
}
UNLOCK();
*new_handle = NULL;
LOCK();
- if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
+ if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
status = php_http_persistent_handle_do_accrete(provider, ident_str, ident_len, old_handle, new_handle TSRMLS_CC);
}
UNLOCK();
LOCK();
if (name_str && name_len) {
- if (SUCCESS == zend_hash_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
+ if (SUCCESS == zend_symtable_find(&php_http_persistent_handles_hash, name_str, name_len+1, (void *) &provider)) {
if (ident_str && ident_len) {
if ((list = php_http_persistent_handle_list_find(provider, ident_str, ident_len TSRMLS_CC))) {
php_http_persistent_handle_list_dtor(list, provider TSRMLS_CC);
array_init(zentry[1]);
add_assoc_long_ex(zentry[1], ZEND_STRS("used"), (*list)->used);
add_assoc_long_ex(zentry[1], ZEND_STRS("free"), zend_hash_num_elements(&(*list)->free));
-
- /* use zend_hash_* not add_assoc_* (which is zend_symtable_*) as we want a string even for numbers */
- zend_hash_add(Z_ARRVAL_P(zentry[0]), key2.str, key2.len, &zentry[1], sizeof(zval *), NULL);
+ add_assoc_zval_ex(zentry[0], key2.str, key2.len, zentry[1]);
}
- zend_hash_add(ht, key1.str, key1.len, &zentry[0], sizeof(zval *), NULL);
+ zend_symtable_update(ht, key1.str, key1.len, &zentry[0], sizeof(zval *), NULL);
}
} else if (ht) {
ht = NULL;
}
} else {
offset = php_http_ztyp(IS_STRING, offset);
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(property), Z_STRVAL_P(offset), Z_STRLEN_P(offset), (void *) &data)) {
+ if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(property), Z_STRVAL_P(offset), Z_STRLEN_P(offset), (void *) &data)) {
retval = *data;
}
zval_ptr_dtor(&offset);
{
zval **arrval, *qarray = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
- if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_hash_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) {
+ if ((Z_TYPE_P(qarray) == IS_ARRAY) && (SUCCESS == zend_symtable_find(Z_ARRVAL_P(qarray), name, name_len + 1, (void *) &arrval))) {
if (type) {
zval *value = php_http_ztyp(type, *arrval);
RETVAL_ZVAL(value, 1, 1);
zval *qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
if (Z_TYPE_P(qa) == IS_ARRAY
- && SUCCESS == zend_hash_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
+ && SUCCESS == zend_symtable_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
) {
RETVAL_ZVAL(*value, 1, 0);
}
zval *qa = zend_read_property(php_http_querystring_class_entry, getThis(), ZEND_STRL("queryArray"), 0 TSRMLS_CC);
if (Z_TYPE_P(qa) == IS_ARRAY
- && SUCCESS == zend_hash_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
+ && SUCCESS == zend_symtable_find(Z_ARRVAL_P(qa), offset_str, offset_len + 1, (void *) &value)
&& Z_TYPE_PP(value) != IS_NULL
) {
RETURN_TRUE;
array_copy(Z_ARRVAL_P(old_opts), Z_ARRVAL_P(new_opts));
}
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(new_opts), key, len, (void *) &entry)) {
+ if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(new_opts), key, len, (void *) &entry)) {
if (overwrite) {
zend_hash_clean(Z_ARRVAL_PP(entry));
}
array_init(return_value);
if ( (Z_TYPE_P(opts) == IS_ARRAY) &&
- (SUCCESS == zend_hash_find(Z_ARRVAL_P(opts), key, len, (void *) &options))) {
+ (SUCCESS == zend_symtable_find(Z_ARRVAL_P(opts), key, len, (void *) &options))) {
convert_to_array(*options);
array_copy(Z_ARRVAL_PP(options), Z_ARRVAL_P(return_value));
}
}
if (info_len && info_name) {
- if (SUCCESS == zend_hash_find(Z_ARRVAL_P(info), php_http_pretty_key(info_name, info_len, 0, 0), info_len + 1, (void *) &infop)) {
+ if (SUCCESS == zend_symtable_find(Z_ARRVAL_P(info), php_http_pretty_key(info_name, info_len, 0, 0), info_len + 1, (void *) &infop)) {
RETVAL_ZVAL(*infop, 1, 0);
} else {
php_http_error(HE_NOTICE, PHP_HTTP_E_INVALID_PARAM, "Could not find transfer info named %s", info_name);
} else if (Z_TYPE_PP(opt) == IS_NULL) {
old_opts = zend_read_property(php_http_request_class_entry, getThis(), ZEND_STRL("options"), 0 TSRMLS_CC);
if (Z_TYPE_P(old_opts) == IS_ARRAY) {
- zend_hash_del(Z_ARRVAL_P(old_opts), key.str, key.len);
+ zend_symtable_del(Z_ARRVAL_P(old_opts), key.str, key.len);
}
} else {
Z_ADDREF_P(*opt);