summaryrefslogtreecommitdiff
path: root/ext/soap/php_sdl.c
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2014-05-15 02:44:47 +0400
committerDmitry Stogov <dmitry@zend.com>2014-05-15 02:44:47 +0400
commitc446e575880d503921a795ee7cc4126b8b84457b (patch)
treef77308734e3f0ae024c5900a852e10b2138e72d0 /ext/soap/php_sdl.c
parent3ae86b9cce0df92069d971feef2af526cdabf7f5 (diff)
downloadphp-git-c446e575880d503921a795ee7cc4126b8b84457b.tar.gz
ext/soap support for phpng (incomplete - just compilable)
Diffstat (limited to 'ext/soap/php_sdl.c')
-rw-r--r--ext/soap/php_sdl.c1099
1 files changed, 522 insertions, 577 deletions
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index cde4ca144b..ff98fae696 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -34,17 +34,18 @@
# define O_BINARY 0
#endif
-static void delete_fault(void *fault);
-static void delete_fault_persistent(void *fault);
-static void delete_binding(void *binding);
-static void delete_binding_persistent(void *binding);
-static void delete_function(void *function);
-static void delete_function_persistent(void *function);
-static void delete_parameter(void *parameter);
-static void delete_parameter_persistent(void *parameter);
-static void delete_header(void *header);
-static void delete_header_persistent(void *header);
-static void delete_document(void *doc_ptr);
+static void delete_fault(zval *zv);
+static void delete_fault_persistent(zval *zv);
+static void delete_binding(zval *zv);
+static void delete_binding_persistent(zval *zv);
+static void delete_function(zval *zv);
+static void delete_function_persistent(zval *zv);
+static void delete_parameter(zval *zv);
+static void delete_parameter_persistent(zval *zv);
+static void delete_header(zval *header);
+static void delete_header_int(sdlSoapBindingFunctionHeaderPtr hdr);
+static void delete_header_persistent(zval *zv);
+static void delete_document(zval *zv);
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr node, const xmlChar *type)
{
@@ -74,7 +75,7 @@ static sdlTypePtr get_element(sdlPtr sdl, xmlNodePtr node, const xmlChar *type)
if (sdl->elements) {
xmlNsPtr nsptr;
char *ns, *cptype;
- sdlTypePtr *sdl_type;
+ sdlTypePtr sdl_type;
parse_namespace(type, &cptype, &ns);
nsptr = xmlSearchNs(node->doc, node, BAD_CAST(ns));
@@ -89,15 +90,15 @@ static sdlTypePtr get_element(sdlPtr sdl, xmlNodePtr node, const xmlChar *type)
memcpy(nscat+ns_len+1, cptype, type_len);
nscat[len] = '\0';
- if (zend_hash_find(sdl->elements, nscat, len + 1, (void **)&sdl_type) == SUCCESS) {
- ret = *sdl_type;
- } else if (zend_hash_find(sdl->elements, (char*)type, type_len + 1, (void **)&sdl_type) == SUCCESS) {
- ret = *sdl_type;
+ if ((sdl_type = zend_hash_str_find_ptr(sdl->elements, nscat, len)) != NULL) {
+ ret = sdl_type;
+ } else if ((sdl_type = zend_hash_str_find_ptr(sdl->elements, (char*)type, type_len)) != NULL) {
+ ret = sdl_type;
}
efree(nscat);
} else {
- if (zend_hash_find(sdl->elements, (char*)type, xmlStrlen(type) + 1, (void **)&sdl_type) == SUCCESS) {
- ret = *sdl_type;
+ if ((sdl_type = zend_hash_str_find_ptr(sdl->elements, (char*)type, xmlStrlen(type))) != NULL) {
+ ret = sdl_type;
}
}
@@ -156,7 +157,7 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
sdl->encoders = pemalloc(sizeof(HashTable), sdl->is_persistent);
zend_hash_init(sdl->encoders, 0, NULL, delete_encoder, sdl->is_persistent);
}
- zend_hash_update(sdl->encoders, nscat, len + 1, &new_enc, sizeof(encodePtr), NULL);
+ zend_hash_str_update_ptr(sdl->encoders, nscat, len, new_enc);
enc = new_enc;
}
}
@@ -166,38 +167,36 @@ encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type)
encodePtr get_encoder_ex(sdlPtr sdl, const char *nscat, int len)
{
- encodePtr *enc;
+ encodePtr enc;
TSRMLS_FETCH();
- if (zend_hash_find(&SOAP_GLOBAL(defEnc), (char*)nscat, len + 1, (void **)&enc) == SUCCESS) {
- return (*enc);
- } else if (sdl && sdl->encoders && zend_hash_find(sdl->encoders, (char*)nscat, len + 1, (void **)&enc) == SUCCESS) {
- return (*enc);
+ if ((enc = zend_hash_str_find_ptr(&SOAP_GLOBAL(defEnc), (char*)nscat, len)) != NULL) {
+ return enc;
+ } else if (sdl && sdl->encoders && (enc = zend_hash_str_find_ptr(sdl->encoders, (char*)nscat, len)) != NULL) {
+ return enc;
}
return NULL;
}
sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type)
{
- sdlBindingPtr *binding;
+ sdlBindingPtr binding;
if (sdl == NULL) {
return NULL;
}
- for (zend_hash_internal_pointer_reset(sdl->bindings);
- zend_hash_get_current_data(sdl->bindings, (void **) &binding) == SUCCESS;
- zend_hash_move_forward(sdl->bindings)) {
- if ((*binding)->bindingType == type) {
- return *binding;
+ ZEND_HASH_FOREACH_PTR(sdl->bindings, binding) {
+ if (binding->bindingType == type) {
+ return binding;
}
- }
+ } ZEND_HASH_FOREACH_END();
return NULL;
}
sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns)
{
- sdlBindingPtr binding = NULL;
+ sdlBindingPtr binding;
smart_str key = {0};
smart_str_appends(&key, ns);
@@ -205,7 +204,7 @@ sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns)
smart_str_appends(&key, name);
smart_str_0(&key);
- zend_hash_find(sdl->bindings, key.c, key.len, (void **)&binding);
+ binding = zend_hash_find_ptr(sdl->bindings, key.s);
smart_str_free(&key);
return binding;
@@ -230,8 +229,8 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC)
{
char *s;
int l1, l2;
- zval *context = NULL;
- zval **header = NULL;
+ zval context;
+ zval *header = NULL;
/* check if we load xsd from the same server */
s = strstr(ctx->sdl->source, "://");
@@ -278,27 +277,25 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC)
}
if (l1 != l2 || memcmp(ctx->sdl->source, uri, l1) != 0) {
/* another server. clear authentication credentals */
- context = php_libxml_switch_context(NULL TSRMLS_CC);
- php_libxml_switch_context(context TSRMLS_CC);
- if (context) {
- ctx->context = php_stream_context_from_zval(context, 1);
+ php_libxml_switch_context(NULL, &context TSRMLS_CC);
+ php_libxml_switch_context(&context, NULL TSRMLS_CC);
+ if (Z_TYPE(context) != IS_UNDEF) {
+ zval *context_ptr = &context;
+ ctx->context = php_stream_context_from_zval(context_ptr, 1);
if (ctx->context &&
- php_stream_context_get_option(ctx->context, "http", "header", &header) == SUCCESS) {
- s = strstr(Z_STRVAL_PP(header), "Authorization: Basic");
- if (s && (s == Z_STRVAL_PP(header) || *(s-1) == '\n' || *(s-1) == '\r')) {
+ (header = php_stream_context_get_option(ctx->context, "http", "header")) != NULL) {
+ s = strstr(Z_STRVAL_P(header), "Authorization: Basic");
+ if (s && (s == Z_STRVAL_P(header) || *(s-1) == '\n' || *(s-1) == '\r')) {
char *rest = strstr(s, "\r\n");
if (rest) {
zval new_header;
rest += 2;
- Z_TYPE(new_header) = IS_STRING;
- Z_STRLEN(new_header) = Z_STRLEN_PP(header) - (rest - s);
- Z_STRVAL(new_header) = emalloc(Z_STRLEN_PP(header) + 1);
- memcpy(Z_STRVAL(new_header), Z_STRVAL_PP(header), s - Z_STRVAL_PP(header));
- memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_PP(header)), rest, Z_STRLEN_PP(header) - (rest - Z_STRVAL_PP(header)) + 1);
- ctx->old_header = *header;
- Z_ADDREF_P(ctx->old_header);
+ ZVAL_STR(&new_header, STR_ALLOC(Z_STRLEN_P(header) - (rest - s), 0));
+ memcpy(Z_STRVAL(new_header), Z_STRVAL_P(header), s - Z_STRVAL_P(header));
+ memcpy(Z_STRVAL(new_header) + (s - Z_STRVAL_P(header)), rest, Z_STRLEN_P(header) - (rest - Z_STRVAL_P(header)) + 1);
+ ZVAL_COPY(&ctx->old_header, header);
php_stream_context_set_option(ctx->context, "http", "header", &new_header);
zval_dtor(&new_header);
}
@@ -310,10 +307,10 @@ void sdl_set_uri_credentials(sdlCtx *ctx, char *uri TSRMLS_DC)
void sdl_restore_uri_credentials(sdlCtx *ctx TSRMLS_DC)
{
- if (ctx->old_header) {
- php_stream_context_set_option(ctx->context, "http", "header", ctx->old_header);
+ if (Z_TYPE(ctx->old_header) != IS_UNDEF) {
+ php_stream_context_set_option(ctx->context, "http", "header", &ctx->old_header);
zval_ptr_dtor(&ctx->old_header);
- ctx->old_header = NULL;
+ ZVAL_UNDEF(&ctx->old_header);
}
ctx->context = NULL;
}
@@ -325,7 +322,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include
xmlNodePtr root, definitions, trav;
xmlAttrPtr targetNamespace;
- if (zend_hash_exists(&ctx->docs, struri, strlen(struri)+1)) {
+ if (zend_hash_str_exists(&ctx->docs, struri, strlen(struri))) {
return;
}
@@ -343,7 +340,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include
}
}
- zend_hash_add(&ctx->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
+ zend_hash_str_add_ptr(&ctx->docs, struri, strlen(struri), wsdl);
root = wsdl->children;
definitions = get_node_ex(root, "definitions", WSDL_NAMESPACE);
@@ -403,7 +400,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include
} else if (node_is_equal(trav,"message")) {
xmlAttrPtr name = get_attribute(trav->properties, "name");
if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->messages, (char*)name->children->content, xmlStrlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
+ if (zend_hash_str_add_ptr(&ctx->messages, (char*)name->children->content, xmlStrlen(name->children->content), trav) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: <message> '%s' already defined", name->children->content);
}
} else {
@@ -413,7 +410,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include
} else if (node_is_equal(trav,"portType")) {
xmlAttrPtr name = get_attribute(trav->properties, "name");
if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->portTypes, (char*)name->children->content, xmlStrlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
+ if (zend_hash_str_add_ptr(&ctx->portTypes, (char*)name->children->content, xmlStrlen(name->children->content), trav) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: <portType> '%s' already defined", name->children->content);
}
} else {
@@ -423,7 +420,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include
} else if (node_is_equal(trav,"binding")) {
xmlAttrPtr name = get_attribute(trav->properties, "name");
if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->bindings, (char*)name->children->content, xmlStrlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
+ if (zend_hash_str_add_ptr(&ctx->bindings, (char*)name->children->content, xmlStrlen(name->children->content), trav) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: <binding> '%s' already defined", name->children->content);
}
} else {
@@ -433,7 +430,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include
} else if (node_is_equal(trav,"service")) {
xmlAttrPtr name = get_attribute(trav->properties, "name");
if (name && name->children && name->children->content) {
- if (zend_hash_add(&ctx->services, (char*)name->children->content, xmlStrlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) {
+ if (zend_hash_str_add_ptr(&ctx->services, (char*)name->children->content, xmlStrlen(name->children->content), trav) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: <service> '%s' already defined", name->children->content);
}
} else {
@@ -464,7 +461,7 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml
} else {
++ctype;
}
- if (zend_hash_find(&ctx->messages, ctype, strlen(ctype)+1, (void**)&message) != SUCCESS) {
+ if ((message = zend_hash_str_find_ptr(&ctx->messages, ctype, strlen(ctype))) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: Missing <message> with name '%s'", tmp->children->content);
}
@@ -545,8 +542,8 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml
}
smart_str_appends(&key,hf->name);
smart_str_0(&key);
- if (zend_hash_add(h->headerfaults, key.c, key.len+1, (void**)&hf, sizeof(sdlSoapBindingFunctionHeaderPtr), NULL) != SUCCESS) {
- delete_header((void**)&hf);
+ if (zend_hash_add_ptr(h->headerfaults, key.s, hf) == NULL) {
+ delete_header_int(hf);
}
smart_str_free(&key);
} else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) {
@@ -588,8 +585,7 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap
/* Delete all parts those are not in the "parts" attribute */
zend_hash_init(&ht, 0, NULL, delete_parameter, 0);
while (*parts) {
- HashPosition pos;
- sdlParamPtr *param;
+ sdlParamPtr param;
int found = 0;
char *end;
@@ -597,20 +593,18 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap
if (*parts == '\0') break;
end = strchr(parts, ' ');
if (end) *end = '\0';
- zend_hash_internal_pointer_reset_ex(params, &pos);
- while (zend_hash_get_current_data_ex(params, (void **)&param, &pos) != FAILURE) {
- if ((*param)->paramName &&
- strcmp(parts, (*param)->paramName) == 0) {
+ ZEND_HASH_FOREACH_PTR(params, param) {
+ if (param->paramName &&
+ strcmp(parts, param->paramName) == 0) {
sdlParamPtr x_param;
x_param = emalloc(sizeof(sdlParam));
- *x_param = **param;
- (*param)->paramName = NULL;
- zend_hash_next_index_insert(&ht, &x_param, sizeof(sdlParamPtr), NULL);
+ *x_param = *param;
+ param->paramName = NULL;
+ zend_hash_next_index_insert_ptr(&ht, x_param);
found = 1;
break;
}
- zend_hash_move_forward_ex(params, &pos);
- }
+ } ZEND_HASH_FOREACH_END();
if (!found) {
soap_error1(E_ERROR, "Parsing WSDL: Missing part '%s' in <message>", parts);
}
@@ -650,8 +644,8 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap
}
smart_str_appends(&key,h->name);
smart_str_0(&key);
- if (zend_hash_add(binding->headers, key.c, key.len+1, (void**)&h, sizeof(sdlSoapBindingFunctionHeaderPtr), NULL) != SUCCESS) {
- delete_header((void**)&h);
+ if (zend_hash_add_ptr(binding->headers, key.s, h) == NULL) {
+ delete_header_int(h);
}
smart_str_free(&key);
} else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) {
@@ -663,7 +657,7 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap
static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
{
- xmlNodePtr trav, part, message = NULL, *tmp;
+ xmlNodePtr trav, part, message = NULL, tmp;
HashTable* parameters = NULL;
char *ctype;
@@ -673,10 +667,10 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
} else {
++ctype;
}
- if (zend_hash_find(&ctx->messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
+ if ((tmp = zend_hash_str_find_ptr(&ctx->messages, ctype, strlen(ctype))) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: Missing <message> with name '%s'", message_name);
}
- message = *tmp;
+ message = tmp;
parameters = emalloc(sizeof(HashTable));
zend_hash_init(parameters, 0, NULL, delete_parameter, 0);
@@ -721,7 +715,7 @@ static HashTable* wsdl_message(sdlCtx *ctx, xmlChar* message_name)
}
}
- zend_hash_next_index_insert(parameters, &param, sizeof(sdlParamPtr), NULL);
+ zend_hash_next_index_insert_ptr(parameters, param);
trav = trav->next;
}
@@ -752,12 +746,11 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
if (n > 0) {
zend_hash_internal_pointer_reset(&ctx.services);
for (i = 0; i < n; i++) {
- xmlNodePtr *tmp, service;
+ xmlNodePtr service, tmp;
xmlNodePtr trav, port;
int has_soap_port = 0;
- zend_hash_get_current_data(&ctx.services, (void **)&tmp);
- service = *tmp;
+ service = tmp = zend_hash_get_current_data_ptr(&ctx.services);
trav = service->children;
while (trav != NULL) {
@@ -840,10 +833,10 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
} else {
++ctype;
}
- if (zend_hash_find(&ctx.bindings, ctype, strlen(ctype)+1, (void*)&tmp) != SUCCESS) {
+ if ((tmp = zend_hash_str_find_ptr(&ctx.bindings, ctype, strlen(ctype))) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: No <binding> element with name '%s'", ctype);
}
- binding = *tmp;
+ binding = tmp;
if (tmpbinding->bindingType == BINDING_SOAP) {
sdlSoapBindingPtr soapBinding;
@@ -895,10 +888,10 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
} else {
++ctype;
}
- if (zend_hash_find(&ctx.portTypes, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) {
+ if ((tmp = zend_hash_str_find_ptr(&ctx.portTypes, ctype, strlen(ctype))) == NULL) {
soap_error1(E_ERROR, "Parsing WSDL: Missing <portType> with name '%s'", name->children->content);
}
- portType = *tmp;
+ portType = tmp;
trav2 = binding->children;
while (trav2 != NULL) {
@@ -1121,7 +1114,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
function->faults = emalloc(sizeof(HashTable));
zend_hash_init(function->faults, 0, NULL, delete_fault, 0);
}
- if (zend_hash_add(function->faults, f->name, strlen(f->name)+1, (void**)&f, sizeof(sdlFaultPtr), NULL) != SUCCESS) {
+ if (zend_hash_str_add_ptr(function->faults, f->name, strlen(f->name), f) == NULL) {
soap_error2(E_ERROR, "Parsing WSDL: <fault> with name '%s' already defined in '%s'", f->name, op_name->children->content);
}
}
@@ -1134,8 +1127,8 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
char *tmp = estrdup(function->functionName);
int len = strlen(tmp);
- if (zend_hash_add(&ctx.sdl->functions, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL) != SUCCESS) {
- zend_hash_next_index_insert(&ctx.sdl->functions, &function, sizeof(sdlFunctionPtr), NULL);
+ if (zend_hash_str_add_ptr(&ctx.sdl->functions, php_strtolower(tmp, len), len, function) == NULL) {
+ zend_hash_next_index_insert_ptr(&ctx.sdl->functions, function);
}
efree(tmp);
if (function->requestName != NULL && strcmp(function->requestName,function->functionName) != 0) {
@@ -1145,7 +1138,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
}
tmp = estrdup(function->requestName);
len = strlen(tmp);
- zend_hash_add(ctx.sdl->requests, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL);
+ zend_hash_str_add_ptr(ctx.sdl->requests, php_strtolower(tmp, len), len, function);
efree(tmp);
}
}
@@ -1157,7 +1150,7 @@ static sdlPtr load_wsdl(zval *this_ptr, char *struri TSRMLS_DC)
zend_hash_init(ctx.sdl->bindings, 0, NULL, delete_binding, 0);
}
- zend_hash_add(ctx.sdl->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL);
+ zend_hash_str_add_ptr(ctx.sdl->bindings, tmpbinding->name, strlen(tmpbinding->name), tmpbinding);
trav= trav->next;
}
@@ -1217,9 +1210,9 @@ static void sdl_deserialize_key(HashTable* ht, void* data, char **in)
WSDL_CACHE_GET_INT(len, in);
if (len == 0) {
- zend_hash_next_index_insert(ht, &data, sizeof(void*), NULL);
+ zend_hash_next_index_insert_ptr(ht, data);
} else {
- zend_hash_add(ht, *in, len, &data, sizeof(void*), NULL);
+ zend_hash_str_add_ptr(ht, *in, len, data);
WSDL_CACHE_SKIP(len, in);
}
}
@@ -1300,7 +1293,7 @@ static sdlContentModelPtr sdl_deserialize_model(sdlTypePtr *types, sdlTypePtr *e
zend_hash_init(model->u.content, i, NULL, delete_model, 0);
while (i > 0) {
sdlContentModelPtr x = sdl_deserialize_model(types, elements, in);
- zend_hash_next_index_insert(model->u.content,&x,sizeof(sdlContentModelPtr),NULL);
+ zend_hash_next_index_insert_ptr(model->u.content, x);
i--;
}
break;
@@ -1797,15 +1790,12 @@ static void sdl_serialize_string(const char *str, smart_str *out)
}
}
-static void sdl_serialize_key(HashTable *ht, smart_str *out)
+// TODO: refactor it
+static void sdl_serialize_key(zend_string *key, smart_str *out)
{
- char *key;
- uint key_len;
- ulong index;
-
- if (zend_hash_get_current_key_ex(ht, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- WSDL_CACHE_PUT_INT(key_len, out);
- WSDL_CACHE_PUT_N(key, key_len, out);
+ if (key) {
+ WSDL_CACHE_PUT_INT(key->len, out);
+ WSDL_CACHE_PUT_N(key->val, key->len, out);
} else {
WSDL_CACHE_PUT_INT(0, out);
}
@@ -1813,9 +1803,9 @@ static void sdl_serialize_key(HashTable *ht, smart_str *out)
static void sdl_serialize_encoder_ref(encodePtr enc, HashTable *tmp_encoders, smart_str *out) {
if (enc) {
- int *encoder_num;
- if (zend_hash_find(tmp_encoders, (char*)&enc, sizeof(enc), (void**)&encoder_num) == SUCCESS) {
- WSDL_CACHE_PUT_INT(*encoder_num, out);
+ zval *encoder_num;
+ if ((encoder_num = zend_hash_str_find(tmp_encoders, (char*)&enc, sizeof(enc))) != 0) {
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(encoder_num), out);
} else {
WSDL_CACHE_PUT_INT(0, out);
}
@@ -1826,9 +1816,9 @@ static void sdl_serialize_encoder_ref(encodePtr enc, HashTable *tmp_encoders, sm
static void sdl_serialize_type_ref(sdlTypePtr type, HashTable *tmp_types, smart_str *out) {
if (type) {
- int *type_num;
- if (zend_hash_find(tmp_types, (char*)&type, sizeof(type), (void**)&type_num) == SUCCESS) {
- WSDL_CACHE_PUT_INT(*type_num, out);
+ zval *type_num;
+ if ((type_num = zend_hash_str_find(tmp_types, (char*)&type, sizeof(type))) != NULL) {
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(type_num), out);
} else {
WSDL_CACHE_PUT_INT(0, out);
}
@@ -1856,14 +1846,14 @@ static void sdl_serialize_attribute(sdlAttributePtr attr, HashTable *tmp_encoder
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlExtraAttributePtr *tmp;
- zend_hash_internal_pointer_reset(attr->extraAttributes);
- while (zend_hash_get_current_data(attr->extraAttributes, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(attr->extraAttributes, out);
- sdl_serialize_string((*tmp)->ns, out);
- sdl_serialize_string((*tmp)->val, out);
- zend_hash_move_forward(attr->extraAttributes);
- }
+ sdlExtraAttributePtr tmp;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(attr->extraAttributes, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_string(tmp->ns, out);
+ sdl_serialize_string(tmp->val, out);
+ } ZEND_HASH_FOREACH_END();
}
}
@@ -1879,15 +1869,13 @@ static void sdl_serialize_model(sdlContentModelPtr model, HashTable *tmp_types,
case XSD_CONTENT_SEQUENCE:
case XSD_CONTENT_ALL:
case XSD_CONTENT_CHOICE: {
- sdlContentModelPtr *tmp;
+ sdlContentModelPtr tmp;
int i = zend_hash_num_elements(model->u.content);
WSDL_CACHE_PUT_INT(i, out);
- zend_hash_internal_pointer_reset(model->u.content);
- while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
- sdl_serialize_model(*tmp, tmp_types, tmp_elements, out);
- zend_hash_move_forward(model->u.content);
- }
+ ZEND_HASH_FOREACH_PTR(model->u.content, tmp) {
+ sdl_serialize_model(tmp, tmp_types, tmp_elements, out);
+ } ZEND_HASH_FOREACH_END();
}
break;
case XSD_CONTENT_GROUP_REF:
@@ -1958,14 +1946,13 @@ static void sdl_serialize_type(sdlTypePtr type, HashTable *tmp_encoders, HashTab
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlRestrictionCharPtr *tmp;
+ sdlRestrictionCharPtr tmp;
+ zend_string *key;
- zend_hash_internal_pointer_reset(type->restrictions->enumeration);
- while (zend_hash_get_current_data(type->restrictions->enumeration, (void**)&tmp) == SUCCESS) {
- sdl_serialize_resriction_char(*tmp, out);
- sdl_serialize_key(type->restrictions->enumeration, out);
- zend_hash_move_forward(type->restrictions->enumeration);
- }
+ ZEND_HASH_FOREACH_STR_KEY_PTR(type->restrictions->enumeration, key, tmp) {
+ sdl_serialize_resriction_char(tmp, out);
+ sdl_serialize_key(key, out);
+ } ZEND_HASH_FOREACH_END();
}
} else {
WSDL_CACHE_PUT_1(0, out);
@@ -1977,19 +1964,20 @@ static void sdl_serialize_type(sdlTypePtr type, HashTable *tmp_encoders, HashTab
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
+ zend_string *key;
+ zval zv;
tmp_elements = emalloc(sizeof(HashTable));
zend_hash_init(tmp_elements, i, NULL, NULL, 0);
- zend_hash_internal_pointer_reset(type->elements);
- while (zend_hash_get_current_data(type->elements, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(type->elements, out);
- sdl_serialize_type(*tmp, tmp_encoders, tmp_types, out);
- zend_hash_add(tmp_elements, (char*)tmp, sizeof(*tmp), &i, sizeof(int), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(type->elements, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_type(tmp, tmp_encoders, tmp_types, out);
+ ZVAL_LONG(&zv, i);
+ zend_hash_str_add(tmp_elements, (char*)&tmp, sizeof(tmp), &zv);
i--;
- zend_hash_move_forward(type->elements);
- }
+ } ZEND_HASH_FOREACH_END();
}
if (type->attributes) {
@@ -1999,13 +1987,13 @@ static void sdl_serialize_type(sdlTypePtr type, HashTable *tmp_encoders, HashTab
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlAttributePtr *tmp;
- zend_hash_internal_pointer_reset(type->attributes);
- while (zend_hash_get_current_data(type->attributes, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(type->attributes, out);
- sdl_serialize_attribute(*tmp, tmp_encoders, out);
- zend_hash_move_forward(type->attributes);
- }
+ sdlAttributePtr tmp;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(type->attributes, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_attribute(tmp, tmp_encoders, out);
+ } ZEND_HASH_FOREACH_END();
}
if (type->model) {
WSDL_CACHE_PUT_1(1, out);
@@ -2038,17 +2026,16 @@ static void sdl_serialize_parameters(HashTable *ht, HashTable *tmp_encoders, Has
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlParamPtr *tmp;
+ sdlParamPtr tmp;
+ zend_string *key;
- zend_hash_internal_pointer_reset(ht);
- while (zend_hash_get_current_data(ht, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(ht, out);
- sdl_serialize_string((*tmp)->paramName, out);
- WSDL_CACHE_PUT_INT((*tmp)->order, out);
- sdl_serialize_encoder_ref((*tmp)->encode, tmp_encoders, out);
- sdl_serialize_type_ref((*tmp)->element, tmp_types, out);
- zend_hash_move_forward(ht);
- }
+ ZEND_HASH_FOREACH_STR_KEY_PTR(ht, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_string(tmp->paramName, out);
+ WSDL_CACHE_PUT_INT(tmp->order, out);
+ sdl_serialize_encoder_ref(tmp->encode, tmp_encoders, out);
+ sdl_serialize_type_ref(tmp->element, tmp_types, out);
+ } ZEND_HASH_FOREACH_END();
}
}
@@ -2068,42 +2055,42 @@ static void sdl_serialize_soap_body(sdlSoapBindingFunctionBodyPtr body, HashTabl
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlSoapBindingFunctionHeaderPtr *tmp;
- zend_hash_internal_pointer_reset(body->headers);
- while (zend_hash_get_current_data(body->headers, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(body->headers, out);
- WSDL_CACHE_PUT_1((*tmp)->use, out);
- if ((*tmp)->use == SOAP_ENCODED) {
- WSDL_CACHE_PUT_1((*tmp)->encodingStyle, out);
- }
- sdl_serialize_string((*tmp)->name, out);
- sdl_serialize_string((*tmp)->ns, out);
- sdl_serialize_encoder_ref((*tmp)->encode, tmp_encoders, out);
- sdl_serialize_type_ref((*tmp)->element, tmp_types, out);
- if ((*tmp)->headerfaults) {
- j = zend_hash_num_elements((*tmp)->headerfaults);
+ sdlSoapBindingFunctionHeaderPtr tmp;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(body->headers, key, tmp) {
+ sdl_serialize_key(key, out);
+ WSDL_CACHE_PUT_1(tmp->use, out);
+ if (tmp->use == SOAP_ENCODED) {
+ WSDL_CACHE_PUT_1(tmp->encodingStyle, out);
+ }
+ sdl_serialize_string(tmp->name, out);
+ sdl_serialize_string(tmp->ns, out);
+ sdl_serialize_encoder_ref(tmp->encode, tmp_encoders, out);
+ sdl_serialize_type_ref(tmp->element, tmp_types, out);
+ if (tmp->headerfaults) {
+ j = zend_hash_num_elements(tmp->headerfaults);
} else {
j = 0;
}
WSDL_CACHE_PUT_INT(j, out);
if (j > 0) {
- sdlSoapBindingFunctionHeaderPtr *tmp2;
- zend_hash_internal_pointer_reset((*tmp)->headerfaults);
- while (zend_hash_get_current_data((*tmp)->headerfaults, (void**)&tmp2) == SUCCESS) {
- sdl_serialize_key((*tmp)->headerfaults, out);
- WSDL_CACHE_PUT_1((*tmp2)->use, out);
- if ((*tmp2)->use == SOAP_ENCODED) {
- WSDL_CACHE_PUT_1((*tmp2)->encodingStyle, out);
+ sdlSoapBindingFunctionHeaderPtr tmp2;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(body->headers, key, tmp2) {
+ sdl_serialize_key(key, out);
+ WSDL_CACHE_PUT_1(tmp2->use, out);
+ if (tmp2->use == SOAP_ENCODED) {
+ WSDL_CACHE_PUT_1(tmp2->encodingStyle, out);
}
- sdl_serialize_string((*tmp2)->name, out);
- sdl_serialize_string((*tmp2)->ns, out);
- sdl_serialize_encoder_ref((*tmp2)->encode, tmp_encoders, out);
- sdl_serialize_type_ref((*tmp2)->element, tmp_types, out);
- zend_hash_move_forward((*tmp)->headerfaults);
- }
+ sdl_serialize_string(tmp2->name, out);
+ sdl_serialize_string(tmp2->ns, out);
+ sdl_serialize_encoder_ref(tmp2->encode, tmp_encoders, out);
+ sdl_serialize_type_ref(tmp2->element, tmp_types, out);
+ } ZEND_HASH_FOREACH_END();
}
- zend_hash_move_forward(body->headers);
- }
+ } ZEND_HASH_FOREACH_END();
}
}
@@ -2149,14 +2136,14 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
+ zval zv;
- zend_hash_internal_pointer_reset(sdl->groups);
- while (zend_hash_get_current_data(sdl->groups, (void**)&tmp) == SUCCESS) {
- zend_hash_add(&tmp_types, (char*)tmp, sizeof(*tmp), (void**)&type_num, sizeof(type_num), NULL);
+ ZEND_HASH_FOREACH_PTR(sdl->groups, tmp) {
+ ZVAL_LONG(&zv, type_num);
+ zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv);
++type_num;
- zend_hash_move_forward(sdl->groups);
- }
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->types) {
@@ -2166,14 +2153,14 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
+ zval zv;
- zend_hash_internal_pointer_reset(sdl->types);
- while (zend_hash_get_current_data(sdl->types, (void**)&tmp) == SUCCESS) {
- zend_hash_add(&tmp_types, (char*)tmp, sizeof(*tmp), (void**)&type_num, sizeof(type_num), NULL);
+ ZEND_HASH_FOREACH_PTR(sdl->types, tmp) {
+ ZVAL_LONG(&zv, type_num);
+ zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv);
++type_num;
- zend_hash_move_forward(sdl->types);
- }
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->elements) {
@@ -2183,14 +2170,14 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
+ zval zv;
- zend_hash_internal_pointer_reset(sdl->elements);
- while (zend_hash_get_current_data(sdl->elements, (void**)&tmp) == SUCCESS) {
- zend_hash_add(&tmp_types, (char*)tmp, sizeof(*tmp), (void**)&type_num, sizeof(type_num), NULL);
+ ZEND_HASH_FOREACH_PTR(sdl->elements, tmp) {
+ ZVAL_LONG(&zv, type_num);
+ zend_hash_str_add(&tmp_types, (char*)&tmp, sizeof(tmp), &zv);
++type_num;
- zend_hash_move_forward(sdl->elements);
- }
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->encoders) {
@@ -2200,60 +2187,63 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- encodePtr *tmp;
+ encodePtr tmp;
+ zval zv;
- zend_hash_internal_pointer_reset(sdl->encoders);
- while (zend_hash_get_current_data(sdl->encoders, (void**)&tmp) == SUCCESS) {
- zend_hash_add(&tmp_encoders, (char*)tmp, sizeof(*tmp), (void**)&encoder_num, sizeof(encoder_num), NULL);
+ ZEND_HASH_FOREACH_PTR(sdl->encoders, tmp) {
+ ZVAL_LONG(&zv, encoder_num);
+ zend_hash_str_add(&tmp_encoders, (char*)&tmp, sizeof(tmp), &zv);
++encoder_num;
- zend_hash_move_forward(sdl->encoders);
- }
+ } ZEND_HASH_FOREACH_END();
}
enc = defaultEncoding;
while (enc->details.type != END_KNOWN_TYPES) {
- zend_hash_add(&tmp_encoders, (char*)&enc, sizeof(encodePtr), (void**)&encoder_num, sizeof(encoder_num), NULL);
+ zval zv;
+
+ ZVAL_LONG(&zv, encoder_num);
+ zend_hash_str_add(&tmp_encoders, (char*)&enc, sizeof(encodePtr), &zv);
enc++;
++encoder_num;
}
if (sdl->groups) {
- sdlTypePtr *tmp;
- zend_hash_internal_pointer_reset(sdl->groups);
- while (zend_hash_get_current_data(sdl->groups, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(sdl->groups, out);
- sdl_serialize_type(*tmp, &tmp_encoders, &tmp_types, out);
- zend_hash_move_forward(sdl->groups);
- }
+ sdlTypePtr tmp;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->groups, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_type(tmp, &tmp_encoders, &tmp_types, out);
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->types) {
- sdlTypePtr *tmp;
- zend_hash_internal_pointer_reset(sdl->types);
- while (zend_hash_get_current_data(sdl->types, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(sdl->types, out);
- sdl_serialize_type(*tmp, &tmp_encoders, &tmp_types, out);
- zend_hash_move_forward(sdl->types);
- }
+ sdlTypePtr tmp;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->types, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_type(tmp, &tmp_encoders, &tmp_types, out);
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->elements) {
- sdlTypePtr *tmp;
- zend_hash_internal_pointer_reset(sdl->elements);
- while (zend_hash_get_current_data(sdl->elements, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(sdl->elements, out);
- sdl_serialize_type(*tmp, &tmp_encoders, &tmp_types, out);
- zend_hash_move_forward(sdl->elements);
- }
+ sdlTypePtr tmp;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->elements, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_type(tmp, &tmp_encoders, &tmp_types, out);
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->encoders) {
- encodePtr *tmp;
- zend_hash_internal_pointer_reset(sdl->encoders);
- while (zend_hash_get_current_data(sdl->encoders, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(sdl->encoders, out);
- sdl_serialize_encoder(*tmp, &tmp_types, out);
- zend_hash_move_forward(sdl->encoders);
- }
+ encodePtr tmp;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->encoders, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_encoder(tmp, &tmp_types, out);
+ } ZEND_HASH_FOREACH_END();
}
/* serialize bindings */
@@ -2264,74 +2254,77 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlBindingPtr *tmp;
+ sdlBindingPtr tmp;
int binding_num = 1;
-
- zend_hash_internal_pointer_reset(sdl->bindings);
- while (zend_hash_get_current_data(sdl->bindings, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(sdl->bindings, out);
- sdl_serialize_string((*tmp)->name, out);
- sdl_serialize_string((*tmp)->location, out);
- WSDL_CACHE_PUT_1((*tmp)->bindingType,out);
- if ((*tmp)->bindingType == BINDING_SOAP && (*tmp)->bindingAttributes != NULL) {
- sdlSoapBindingPtr binding = (sdlSoapBindingPtr)(*tmp)->bindingAttributes;
+ zval zv;
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->bindings, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_string(tmp->name, out);
+ sdl_serialize_string(tmp->location, out);
+ WSDL_CACHE_PUT_1(tmp->bindingType,out);
+ if (tmp->bindingType == BINDING_SOAP && tmp->bindingAttributes != NULL) {
+ sdlSoapBindingPtr binding = (sdlSoapBindingPtr)tmp->bindingAttributes;
WSDL_CACHE_PUT_1(binding->style, out);
WSDL_CACHE_PUT_1(binding->transport, out);
} else {
WSDL_CACHE_PUT_1(0,out);
}
- zend_hash_add(&tmp_bindings, (char*)tmp, sizeof(*tmp), (void**)&binding_num, sizeof(binding_num), NULL);
+ ZVAL_LONG(&zv, binding_num);
+ zend_hash_str_add(&tmp_bindings, (char*)&tmp, sizeof(tmp), &zv);
binding_num++;
- zend_hash_move_forward(sdl->bindings);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* serialize functions */
i = zend_hash_num_elements(&sdl->functions);
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlFunctionPtr *tmp;
- int *binding_num;
+ sdlFunctionPtr tmp;
+ zval *binding_num, zv;
int function_num = 1;
-
- zend_hash_internal_pointer_reset(&sdl->functions);
- while (zend_hash_get_current_data(&sdl->functions, (void**)&tmp) == SUCCESS) {
- sdl_serialize_key(&sdl->functions, out);
- sdl_serialize_string((*tmp)->functionName, out);
- sdl_serialize_string((*tmp)->requestName, out);
- sdl_serialize_string((*tmp)->responseName, out);
-
- if ((*tmp)->binding == NULL ||
- zend_hash_find(&tmp_bindings,(char*)&(*tmp)->binding,sizeof((*tmp)->binding), (void**)&binding_num) != SUCCESS) {
- }
- WSDL_CACHE_PUT_INT(*binding_num, out);
- if (*binding_num >= 0) {
- if ((*tmp)->binding->bindingType == BINDING_SOAP && (*tmp)->bindingAttributes != NULL) {
- sdlSoapBindingFunctionPtr binding = (sdlSoapBindingFunctionPtr)(*tmp)->bindingAttributes;
- WSDL_CACHE_PUT_1(binding->style, out);
- sdl_serialize_string(binding->soapAction, out);
- sdl_serialize_soap_body(&binding->input, &tmp_encoders, &tmp_types, out);
- sdl_serialize_soap_body(&binding->output, &tmp_encoders, &tmp_types, out);
- } else {
- WSDL_CACHE_PUT_1(0,out);
+ zend_string *key;
+
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&sdl->functions, key, tmp) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_string(tmp->functionName, out);
+ sdl_serialize_string(tmp->requestName, out);
+ sdl_serialize_string(tmp->responseName, out);
+
+ if (tmp->binding) {
+ binding_num = zend_hash_str_find(&tmp_bindings,(char*)&tmp->binding, sizeof(tmp->binding));
+ if (binding_num) {
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(binding_num), out);
+ if (Z_LVAL_P(binding_num) >= 0) {
+ if (tmp->binding->bindingType == BINDING_SOAP && tmp->bindingAttributes != NULL) {
+ sdlSoapBindingFunctionPtr binding = (sdlSoapBindingFunctionPtr)tmp->bindingAttributes;
+ WSDL_CACHE_PUT_1(binding->style, out);
+ sdl_serialize_string(binding->soapAction, out);
+ sdl_serialize_soap_body(&binding->input, &tmp_encoders, &tmp_types, out);
+ sdl_serialize_soap_body(&binding->output, &tmp_encoders, &tmp_types, out);
+ } else {
+ WSDL_CACHE_PUT_1(0,out);
+ }
+ }
}
}
- sdl_serialize_parameters((*tmp)->requestParameters, &tmp_encoders, &tmp_types, out);
- sdl_serialize_parameters((*tmp)->responseParameters, &tmp_encoders, &tmp_types, out);
+ sdl_serialize_parameters(tmp->requestParameters, &tmp_encoders, &tmp_types, out);
+ sdl_serialize_parameters(tmp->responseParameters, &tmp_encoders, &tmp_types, out);
- if ((*tmp)->faults) {
- sdlFaultPtr *fault;
+ if (tmp->faults) {
+ sdlFaultPtr fault;
+ zend_string *key;
- WSDL_CACHE_PUT_INT(zend_hash_num_elements((*tmp)->faults), out);
+ WSDL_CACHE_PUT_INT(zend_hash_num_elements(tmp->faults), out);
- zend_hash_internal_pointer_reset((*tmp)->faults);
- while (zend_hash_get_current_data((*tmp)->faults, (void**)&fault) == SUCCESS) {
- sdl_serialize_key((*tmp)->faults, out);
- sdl_serialize_string((*fault)->name, out);
- sdl_serialize_parameters((*fault)->details, &tmp_encoders, &tmp_types, out);
- if ((*tmp)->binding->bindingType == BINDING_SOAP && (*fault)->bindingAttributes != NULL) {
- sdlSoapBindingFunctionFaultPtr binding = (sdlSoapBindingFunctionFaultPtr)(*fault)->bindingAttributes;
+ ZEND_HASH_FOREACH_STR_KEY_PTR(tmp->faults, key, fault) {
+ sdl_serialize_key(key, out);
+ sdl_serialize_string(fault->name, out);
+ sdl_serialize_parameters(fault->details, &tmp_encoders, &tmp_types, out);
+ if (tmp->binding->bindingType == BINDING_SOAP && fault->bindingAttributes != NULL) {
+ sdlSoapBindingFunctionFaultPtr binding = (sdlSoapBindingFunctionFaultPtr)fault->bindingAttributes;
WSDL_CACHE_PUT_1(binding->use, out);
if (binding->use == SOAP_ENCODED) {
WSDL_CACHE_PUT_1(binding->encodingStyle, out);
@@ -2340,16 +2333,15 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
} else {
WSDL_CACHE_PUT_1(0, out);
}
- zend_hash_move_forward((*tmp)->faults);
- }
+ } ZEND_HASH_FOREACH_END();
} else {
WSDL_CACHE_PUT_INT(0, out);
}
- zend_hash_add(&tmp_functions, (char*)tmp, sizeof(*tmp), (void**)&function_num, sizeof(function_num), NULL);
+ ZVAL_LONG(&zv, function_num);
+ zend_hash_str_add(&tmp_functions, (char*)&tmp, sizeof(tmp), &zv);
function_num++;
- zend_hash_move_forward(&sdl->functions);
- }
+ } ZEND_HASH_FOREACH_END();
}
/* serialize requests */
@@ -2360,20 +2352,18 @@ static void add_sdl_to_cache(const char *fn, const char *uri, time_t t, sdlPtr s
}
WSDL_CACHE_PUT_INT(i, out);
if (i > 0) {
- sdlFunctionPtr *tmp;
- int *function_num;
+ sdlFunctionPtr tmp;
+ zval *function_num;
+ zend_string *key;
- zend_hash_internal_pointer_reset(sdl->requests);
- while (zend_hash_get_current_data(sdl->requests, (void**)&tmp) == SUCCESS) {
- if (zend_hash_find(&tmp_functions, (char*)tmp, sizeof(*tmp), (void**)&function_num) != SUCCESS) {
- }
- WSDL_CACHE_PUT_INT(*function_num, out);
- sdl_serialize_key(sdl->requests, out);
- zend_hash_move_forward(sdl->requests);
- }
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->requests, key, tmp) {
+ function_num = zend_hash_str_find(&tmp_functions, (char*)&tmp, sizeof(tmp));
+ WSDL_CACHE_PUT_INT(Z_LVAL_P(function_num), out);
+ sdl_serialize_key(key, out);
+ } ZEND_HASH_FOREACH_END();
}
- php_ignore_value(write(f, buf.c, buf.len));
+ php_ignore_value(write(f, buf.s->val, buf.s->len));
close(f);
smart_str_free(&buf);
zend_hash_destroy(&tmp_functions);
@@ -2394,9 +2384,8 @@ static void make_persistent_restriction_int(void *data)
}
-static void make_persistent_restriction_char(void *data)
+static void make_persistent_restriction_char_int(sdlRestrictionCharPtr *rest)
{
- sdlRestrictionCharPtr *rest = (sdlRestrictionCharPtr *)data;
sdlRestrictionCharPtr prest = NULL;
prest = malloc(sizeof(sdlRestrictionChar));
@@ -2407,31 +2396,37 @@ static void make_persistent_restriction_char(void *data)
}
+static void make_persistent_restriction_char(zval *zv)
+{
+ make_persistent_restriction_char_int((sdlRestrictionCharPtr*)&Z_PTR_P(zv));
+}
+
+
static void make_persistent_sdl_type_ref(sdlTypePtr *type, HashTable *ptr_map, HashTable *bp_types)
{
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
- if (zend_hash_find(ptr_map, (char *)type, sizeof(sdlTypePtr), (void**)&tmp) == SUCCESS) {
- *type = *tmp;
+ if ((tmp = zend_hash_str_find_ptr(ptr_map, (char *)type, sizeof(sdlTypePtr))) != NULL) {
+ *type = tmp;
} else {
- zend_hash_next_index_insert(bp_types, (void*)&type, sizeof(sdlTypePtr*), NULL);
+ zend_hash_next_index_insert_ptr(bp_types, *type);
}
}
static void make_persistent_sdl_encoder_ref(encodePtr *enc, HashTable *ptr_map, HashTable *bp_encoders)
{
- encodePtr *tmp;
+ encodePtr tmp;
/* do not process defaultEncoding's here */
if ((*enc) >= defaultEncoding && (*enc) < defaultEncoding + numDefaultEncodings) {
return;
}
- if (zend_hash_find(ptr_map, (char *)enc, sizeof(encodePtr), (void**)&tmp) == SUCCESS) {
- *enc = *tmp;
+ if ((tmp = zend_hash_str_find_ptr(ptr_map, (char *)enc, sizeof(encodePtr))) != NULL) {
+ *enc = tmp;
} else {
- zend_hash_next_index_insert(bp_encoders, (void*)&enc, sizeof(encodePtr*), NULL);
+ zend_hash_next_index_insert_ptr(bp_encoders, *enc);
}
}
@@ -2439,21 +2434,18 @@ static void make_persistent_sdl_encoder_ref(encodePtr *enc, HashTable *ptr_map,
static HashTable* make_persistent_sdl_function_headers(HashTable *headers, HashTable *ptr_map)
{
HashTable *pheaders;
- sdlSoapBindingFunctionHeaderPtr *tmp, pheader;
- encodePtr *penc;
- sdlTypePtr *ptype;
- ulong index;
- char *key;
- uint key_len;
+ sdlSoapBindingFunctionHeaderPtr tmp, pheader;
+ encodePtr penc;
+ sdlTypePtr ptype;
+ zend_string *key;
pheaders = malloc(sizeof(HashTable));
zend_hash_init(pheaders, zend_hash_num_elements(headers), NULL, delete_header_persistent, 1);
- zend_hash_internal_pointer_reset(headers);
- while (zend_hash_get_current_data(headers, (void**)&tmp) == SUCCESS) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(headers, key, tmp) {
pheader = malloc(sizeof(sdlSoapBindingFunctionHeader));
memset(pheader, 0, sizeof(sdlSoapBindingFunctionHeader));
- *pheader = **tmp;
+ *pheader = *tmp;
if (pheader->name) {
pheader->name = strdup(pheader->name);
@@ -2463,30 +2455,28 @@ static HashTable* make_persistent_sdl_function_headers(HashTable *headers, HashT
}
if (pheader->encode->details.sdl_type) {
- if (zend_hash_find(ptr_map, (char*)&pheader->encode, sizeof(encodePtr), (void**)&penc) == FAILURE) {
+ if ((penc = zend_hash_str_find_ptr(ptr_map, (char*)&pheader->encode, sizeof(encodePtr))) == NULL) {
assert(0);
}
- pheader->encode = *penc;
+ pheader->encode = penc;
}
if (pheader->element) {
- if (zend_hash_find(ptr_map, (char*)&pheader->element, sizeof(sdlTypePtr), (void**)&ptype) == FAILURE) {
+ if ((ptype = zend_hash_str_find_ptr(ptr_map, (char*)&pheader->element, sizeof(sdlTypePtr))) == NULL) {
assert(0);
}
- pheader->element = *ptype;
+ pheader->element = ptype;
}
if (pheader->headerfaults) {
pheader->headerfaults = make_persistent_sdl_function_headers(pheader->headerfaults, ptr_map);
}
- if (zend_hash_get_current_key_ex(headers, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(pheaders, key, key_len, (void*)&pheader, sizeof(sdlSoapBindingFunctionHeaderPtr), NULL);
+ if (key) {
+ zend_hash_add_ptr(pheaders, key, pheader);
} else {
- zend_hash_next_index_insert(pheaders, (void*)&pheader, sizeof(sdlSoapBindingFunctionHeaderPtr), NULL);
+ zend_hash_next_index_insert_ptr(pheaders, pheader);
}
-
- zend_hash_move_forward(headers);
- }
+ } ZEND_HASH_FOREACH_END();
return pheaders;
}
@@ -2507,48 +2497,42 @@ static void make_persistent_sdl_soap_body(sdlSoapBindingFunctionBodyPtr body, Ha
static HashTable* make_persistent_sdl_parameters(HashTable *params, HashTable *ptr_map)
{
HashTable *pparams;
- sdlParamPtr *tmp, pparam;
- sdlTypePtr *ptype;
- encodePtr *penc;
- ulong index;
- char *key;
- uint key_len;
+ sdlParamPtr tmp, pparam;
+ sdlTypePtr ptype;
+ encodePtr penc;
+ zend_string *key;
pparams = malloc(sizeof(HashTable));
zend_hash_init(pparams, zend_hash_num_elements(params), NULL, delete_parameter_persistent, 1);
- zend_hash_internal_pointer_reset(params);
- while (zend_hash_get_current_data(params, (void**)&tmp) == SUCCESS) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(params, key, tmp) {
pparam = malloc(sizeof(sdlParam));
memset(pparam, 0, sizeof(sdlParam));
- *pparam = **tmp;
+ *pparam = *tmp;
if (pparam->paramName) {
pparam->paramName = strdup(pparam->paramName);
}
if (pparam->encode && pparam->encode->details.sdl_type) {
- if (zend_hash_find(ptr_map, (char*)&pparam->encode, sizeof(encodePtr), (void**)&penc) == FAILURE) {
+ if ((penc = zend_hash_str_find_ptr(ptr_map, (char*)&pparam->encode, sizeof(encodePtr))) == NULL) {
assert(0);
}
- pparam->encode = *penc;
+ pparam->encode = penc;
}
if (pparam->element) {
- if (zend_hash_find(ptr_map, (char*)&pparam->element, sizeof(sdlTypePtr), (void**)&ptype) == FAILURE) {
+ if ((ptype = zend_hash_str_find_ptr(ptr_map, (char*)&pparam->element, sizeof(sdlTypePtr))) == NULL) {
assert(0);
}
- pparam->element = *ptype;
+ pparam->element = ptype;
}
- if (zend_hash_get_current_key_ex(params, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(pparams, key, key_len, (void*)&pparam, sizeof(sdlParamPtr), NULL);
+ if (key) {
+ zend_hash_add_ptr(pparams, key, pparam);
} else {
- zend_hash_next_index_insert(pparams, (void*)&pparam, sizeof(sdlParamPtr), NULL);
+ zend_hash_next_index_insert_ptr(pparams, pparam);
}
-
- zend_hash_move_forward(params);
- }
-
+ } ZEND_HASH_FOREACH_END();
return pparams;
}
@@ -2556,19 +2540,16 @@ static HashTable* make_persistent_sdl_parameters(HashTable *params, HashTable *p
static HashTable* make_persistent_sdl_function_faults(sdlFunctionPtr func, HashTable *faults, HashTable *ptr_map)
{
HashTable *pfaults;
- sdlFaultPtr *tmp, pfault;
- ulong index;
- char *key;
- uint key_len;
+ sdlFaultPtr tmp, pfault;
+ zend_string *key;
pfaults = malloc(sizeof(HashTable));
zend_hash_init(pfaults, zend_hash_num_elements(faults), NULL, delete_fault_persistent, 1);
- zend_hash_internal_pointer_reset(faults);
- while (zend_hash_get_current_data(faults, (void**)&tmp) == SUCCESS) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(faults, key, tmp) {
pfault = malloc(sizeof(sdlFault));
memset(pfault, 0, sizeof(sdlFault));
- *pfault = **tmp;
+ *pfault = *tmp;
if (pfault->name) {
pfault->name = strdup(pfault->name);
@@ -2589,15 +2570,13 @@ static HashTable* make_persistent_sdl_function_faults(sdlFunctionPtr func, HashT
pfault->bindingAttributes = soap_binding;
}
- if (zend_hash_get_current_key_ex(faults, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(pfaults, key, key_len, (void*)&pfault, sizeof(sdlParamPtr), NULL);
+ if (key) {
+ zend_hash_add_ptr(pfaults, key, pfault);
} else {
- zend_hash_next_index_insert(pfaults, (void*)&pfault, sizeof(sdlParamPtr), NULL);
+ zend_hash_next_index_insert_ptr(pfaults, pfault);
}
- zend_hash_move_forward(faults);
- }
-
+ } ZEND_HASH_FOREACH_END();
return pfaults;
}
@@ -2606,9 +2585,7 @@ static HashTable* make_persistent_sdl_function_faults(sdlFunctionPtr func, HashT
static sdlAttributePtr make_persistent_sdl_attribute(sdlAttributePtr attr, HashTable *ptr_map, HashTable *bp_types, HashTable *bp_encoders)
{
sdlAttributePtr pattr;
- ulong index;
- char *key;
- uint key_len;
+ zend_string *key;
pattr = malloc(sizeof(sdlAttribute));
memset(pattr, 0, sizeof(sdlAttribute));
@@ -2637,29 +2614,26 @@ static sdlAttributePtr make_persistent_sdl_attribute(sdlAttributePtr attr, HashT
}
if (pattr->extraAttributes) {
- sdlExtraAttributePtr *tmp, pextra;
+ sdlExtraAttributePtr tmp, pextra;
pattr->extraAttributes = malloc(sizeof(HashTable));
zend_hash_init(pattr->extraAttributes, zend_hash_num_elements(attr->extraAttributes), NULL, delete_extra_attribute_persistent, 1);
- zend_hash_internal_pointer_reset(pattr->extraAttributes);
- while (zend_hash_get_current_data(attr->extraAttributes, (void**)&tmp) == SUCCESS) {
- if (zend_hash_get_current_key_ex(attr->extraAttributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(pattr->extraAttributes, key, tmp) {
+ if (key) {
pextra = malloc(sizeof(sdlExtraAttribute));
memset(pextra, 0, sizeof(sdlExtraAttribute));
- if ((*tmp)->ns) {
- pextra->ns = strdup((*tmp)->ns);
+ if (tmp->ns) {
+ pextra->ns = strdup(tmp->ns);
}
- if ((*tmp)->val) {
- pextra->val = strdup((*tmp)->val);
+ if (tmp->val) {
+ pextra->val = strdup(tmp->val);
}
- zend_hash_add(pattr->extraAttributes, key, key_len, (void*)&pextra, sizeof(sdlExtraAttributePtr), NULL);
+ zend_hash_add_ptr(pattr->extraAttributes, key, pextra);
}
-
- zend_hash_move_forward(attr->extraAttributes);
- }
+ } ZEND_HASH_FOREACH_END();
}
return pattr;
@@ -2669,7 +2643,7 @@ static sdlAttributePtr make_persistent_sdl_attribute(sdlAttributePtr attr, HashT
static sdlContentModelPtr make_persistent_sdl_model(sdlContentModelPtr model, HashTable *ptr_map, HashTable *bp_types, HashTable *bp_encoders)
{
sdlContentModelPtr pmodel;
- sdlContentModelPtr *tmp, pcontent;
+ sdlContentModelPtr tmp, pcontent;
pmodel = malloc(sizeof(sdlContentModel));
memset(pmodel, 0, sizeof(sdlContentModel));
@@ -2688,12 +2662,10 @@ static sdlContentModelPtr make_persistent_sdl_model(sdlContentModelPtr model, Ha
pmodel->u.content = malloc(sizeof(HashTable));
zend_hash_init(pmodel->u.content, zend_hash_num_elements(model->u.content), NULL, delete_model_persistent, 1);
- zend_hash_internal_pointer_reset(model->u.content);
- while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
- pcontent = make_persistent_sdl_model(*tmp, ptr_map, bp_types, bp_encoders);
- zend_hash_next_index_insert(pmodel->u.content, (void*)&pcontent, sizeof(sdlContentModelPtr), NULL);
- zend_hash_move_forward(model->u.content);
- }
+ ZEND_HASH_FOREACH_PTR(model->u.content, tmp) {
+ pcontent = make_persistent_sdl_model(tmp, ptr_map, bp_types, bp_encoders);
+ zend_hash_next_index_insert_ptr(pmodel->u.content, pcontent);
+ } ZEND_HASH_FOREACH_END();
break;
case XSD_CONTENT_GROUP_REF:
@@ -2718,9 +2690,7 @@ static sdlContentModelPtr make_persistent_sdl_model(sdlContentModelPtr model, Ha
static sdlTypePtr make_persistent_sdl_type(sdlTypePtr type, HashTable *ptr_map, HashTable *bp_types, HashTable *bp_encoders)
{
- ulong index;
- char *key;
- uint key_len;
+ zend_string *key;
sdlTypePtr ptype = NULL;
ptype = malloc(sizeof(sdlType));
@@ -2782,56 +2752,50 @@ static sdlTypePtr make_persistent_sdl_type(sdlTypePtr type, HashTable *ptr_map,
make_persistent_restriction_int(&ptype->restrictions->maxLength);
}
if (ptype->restrictions->whiteSpace) {
- make_persistent_restriction_char(&ptype->restrictions->whiteSpace);
+ make_persistent_restriction_char_int(&ptype->restrictions->whiteSpace);
}
if (ptype->restrictions->pattern) {
- make_persistent_restriction_char(&ptype->restrictions->pattern);
+ make_persistent_restriction_char_int(&ptype->restrictions->pattern);
}
if (type->restrictions->enumeration) {
- sdlRestrictionCharPtr tmp;
-
ptype->restrictions->enumeration = malloc(sizeof(HashTable));
zend_hash_init(ptype->restrictions->enumeration, zend_hash_num_elements(type->restrictions->enumeration), NULL, delete_restriction_var_char_persistent, 1);
- zend_hash_copy(ptype->restrictions->enumeration, type->restrictions->enumeration, make_persistent_restriction_char, (void*)&tmp, sizeof(sdlRestrictionCharPtr));
+ zend_hash_copy(ptype->restrictions->enumeration, type->restrictions->enumeration, make_persistent_restriction_char);
}
}
if (ptype->elements) {
- sdlTypePtr *tmp, pelem;
+ sdlTypePtr tmp, pelem;
ptype->elements = malloc(sizeof(HashTable));
zend_hash_init(ptype->elements, zend_hash_num_elements(type->elements), NULL, delete_type_persistent, 1);
- zend_hash_internal_pointer_reset(type->elements);
- while (zend_hash_get_current_data(type->elements, (void **)&tmp) == SUCCESS) {
- pelem = make_persistent_sdl_type(*tmp, ptr_map, bp_types, bp_encoders);
- if (zend_hash_get_current_key_ex(type->elements, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(ptype->elements, key, key_len, (void*)&pelem, sizeof(sdlTypePtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(type->elements, key, tmp) {
+ pelem = make_persistent_sdl_type(tmp, ptr_map, bp_types, bp_encoders);
+ if (key) {
+ zend_hash_add_ptr(ptype->elements, key, pelem);
} else {
- zend_hash_next_index_insert(ptype->elements, (void*)&pelem, sizeof(sdlTypePtr), NULL);
+ zend_hash_next_index_insert_ptr(ptype->elements, pelem);
}
- zend_hash_add(ptr_map, (char*)tmp, sizeof(*tmp), (void*)&pelem, sizeof(sdlTypePtr), NULL);
- zend_hash_move_forward(type->elements);
- }
+ zend_hash_str_add_ptr(ptr_map, (char*)&tmp, sizeof(tmp), pelem);
+ } ZEND_HASH_FOREACH_END();
}
if (ptype->attributes) {
- sdlAttributePtr *tmp, pattr;
+ sdlAttributePtr tmp, pattr;
ptype->attributes = malloc(sizeof(HashTable));
zend_hash_init(ptype->attributes, zend_hash_num_elements(type->attributes), NULL, delete_attribute_persistent, 1);
- zend_hash_internal_pointer_reset(type->attributes);
- while (zend_hash_get_current_data(type->attributes, (void **)&tmp) == SUCCESS) {
- pattr = make_persistent_sdl_attribute(*tmp, ptr_map, bp_types, bp_encoders);
- if (zend_hash_get_current_key_ex(type->attributes, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(ptype->attributes, key, key_len, (void*)&pattr, sizeof(sdlAttributePtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(type->attributes, key, tmp) {
+ pattr = make_persistent_sdl_attribute(tmp, ptr_map, bp_types, bp_encoders);
+ if (key) {
+ zend_hash_add_ptr(ptype->attributes, key, pattr);
} else {
- zend_hash_next_index_insert(ptype->attributes, (void*)&pattr, sizeof(sdlAttributePtr), NULL);
+ zend_hash_next_index_insert_ptr(ptype->attributes, pattr);
}
- zend_hash_move_forward(type->attributes);
- }
+ } ZEND_HASH_FOREACH_END();
}
if (type->model) {
@@ -2912,12 +2876,12 @@ static sdlFunctionPtr make_persistent_sdl_function(sdlFunctionPtr func, HashTabl
}
if (pfunc->binding) {
- sdlBindingPtr *tmp;
+ sdlBindingPtr tmp;
- if (zend_hash_find(ptr_map, (char*)&pfunc->binding, sizeof(pfunc->binding), (void**)&tmp) == FAILURE) {
+ if ((tmp = zend_hash_str_find_ptr(ptr_map, (char*)&pfunc->binding, sizeof(pfunc->binding))) == NULL) {
assert(0);
}
- pfunc->binding = *tmp;
+ pfunc->binding = tmp;
if (pfunc->binding->bindingType == BINDING_SOAP && pfunc->bindingAttributes) {
sdlSoapBindingFunctionPtr soap_binding;
@@ -2952,9 +2916,7 @@ static sdlPtr make_persistent_sdl(sdlPtr sdl TSRMLS_DC)
sdlPtr psdl = NULL;
HashTable ptr_map;
HashTable bp_types, bp_encoders;
- ulong index;
- char *key;
- uint key_len;
+ zend_string *key;
zend_hash_init(&bp_types, 0, NULL, NULL, 0);
zend_hash_init(&bp_encoders, 0, NULL, NULL, 0);
@@ -2971,168 +2933,153 @@ static sdlPtr make_persistent_sdl(sdlPtr sdl TSRMLS_DC)
}
if (sdl->groups) {
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
sdlTypePtr ptype;
psdl->groups = malloc(sizeof(HashTable));
zend_hash_init(psdl->groups, zend_hash_num_elements(sdl->groups), NULL, delete_type_persistent, 1);
- zend_hash_internal_pointer_reset(sdl->groups);
- while (zend_hash_get_current_data(sdl->groups, (void **)&tmp) == SUCCESS) {
- ptype = make_persistent_sdl_type(*tmp, &ptr_map, &bp_types, &bp_encoders);
- if (zend_hash_get_current_key_ex(sdl->groups, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(psdl->groups, key, key_len, (void*)&ptype, sizeof(sdlTypePtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->groups, key, tmp) {
+ ptype = make_persistent_sdl_type(tmp, &ptr_map, &bp_types, &bp_encoders);
+ if (key) {
+ zend_hash_add_ptr(psdl->groups, key, ptype);
} else {
- zend_hash_next_index_insert(psdl->groups, (void*)&ptype, sizeof(sdlTypePtr), NULL);
+ zend_hash_next_index_insert_ptr(psdl->groups, ptype);
}
- zend_hash_add(&ptr_map, (char*)tmp, sizeof(*tmp), (void*)&ptype, sizeof(sdlTypePtr), NULL);
- zend_hash_move_forward(sdl->groups);
- }
+ zend_hash_str_add_ptr(&ptr_map, (char*)&tmp, sizeof(tmp), ptype);
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->types) {
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
sdlTypePtr ptype;
psdl->types = malloc(sizeof(HashTable));
zend_hash_init(psdl->types, zend_hash_num_elements(sdl->types), NULL, delete_type_persistent, 1);
- zend_hash_internal_pointer_reset(sdl->types);
- while (zend_hash_get_current_data(sdl->types, (void **)&tmp) == SUCCESS) {
- ptype = make_persistent_sdl_type(*tmp, &ptr_map, &bp_types, &bp_encoders);
- if (zend_hash_get_current_key_ex(sdl->types, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(psdl->types, key, key_len, (void*)&ptype, sizeof(sdlTypePtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->types, key, tmp) {
+ ptype = make_persistent_sdl_type(tmp, &ptr_map, &bp_types, &bp_encoders);
+ if (key) {
+ zend_hash_add_ptr(psdl->types, key, ptype);
} else {
- zend_hash_next_index_insert(psdl->types, (void*)&ptype, sizeof(sdlTypePtr), NULL);
+ zend_hash_next_index_insert_ptr(psdl->types, ptype);
}
- zend_hash_add(&ptr_map, (char*)tmp, sizeof(*tmp), (void*)&ptype, sizeof(sdlTypePtr), NULL);
- zend_hash_move_forward(sdl->types);
- }
+ zend_hash_str_add_ptr(&ptr_map, (char*)&tmp, sizeof(tmp), ptype);
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->elements) {
- sdlTypePtr *tmp;
+ sdlTypePtr tmp;
sdlTypePtr ptype;
psdl->elements = malloc(sizeof(HashTable));
zend_hash_init(psdl->elements, zend_hash_num_elements(sdl->elements), NULL, delete_type_persistent, 1);
- zend_hash_internal_pointer_reset(sdl->elements);
- while (zend_hash_get_current_data(sdl->elements, (void **)&tmp) == SUCCESS) {
- ptype = make_persistent_sdl_type(*tmp, &ptr_map, &bp_types, &bp_encoders);
- if (zend_hash_get_current_key_ex(sdl->elements, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(psdl->elements, key, key_len, (void*)&ptype, sizeof(sdlTypePtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->elements, key, tmp) {
+ ptype = make_persistent_sdl_type(tmp, &ptr_map, &bp_types, &bp_encoders);
+ if (key) {
+ zend_hash_add_ptr(psdl->elements, key, ptype);
} else {
- zend_hash_next_index_insert(psdl->elements, (void*)&ptype, sizeof(sdlTypePtr), NULL);
+ zend_hash_next_index_insert_ptr(psdl->elements, ptype);
}
- zend_hash_add(&ptr_map, (char*)tmp, sizeof(*tmp), (void*)&ptype, sizeof(sdlTypePtr), NULL);
- zend_hash_move_forward(sdl->elements);
- }
+ zend_hash_str_add_ptr(&ptr_map, (char*)&tmp, sizeof(tmp), ptype);
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->encoders) {
- encodePtr *tmp;
+ encodePtr tmp;
encodePtr penc;
psdl->encoders = malloc(sizeof(HashTable));
zend_hash_init(psdl->encoders, zend_hash_num_elements(sdl->encoders), NULL, delete_encoder_persistent, 1);
- zend_hash_internal_pointer_reset(sdl->encoders);
- while (zend_hash_get_current_data(sdl->encoders, (void **)&tmp) == SUCCESS) {
- penc = make_persistent_sdl_encoder(*tmp, &ptr_map, &bp_types, &bp_encoders);
- if (zend_hash_get_current_key_ex(sdl->encoders, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(psdl->encoders, key, key_len, (void*)&penc, sizeof(encodePtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->encoders, key, tmp) {
+ penc = make_persistent_sdl_encoder(tmp, &ptr_map, &bp_types, &bp_encoders);
+ if (key) {
+ zend_hash_add_ptr(psdl->encoders, key, penc);
} else {
- zend_hash_next_index_insert(psdl->encoders, (void*)&penc, sizeof(encodePtr), NULL);
+ zend_hash_next_index_insert_ptr(psdl->encoders, penc);
}
- zend_hash_add(&ptr_map, (char*)tmp, sizeof(*tmp), (void*)&penc, sizeof(encodePtr), NULL);
- zend_hash_move_forward(sdl->encoders);
- }
+ zend_hash_str_add_ptr(&ptr_map, (char*)&tmp, sizeof(tmp), penc);
+ } ZEND_HASH_FOREACH_END();
}
/* do backpatching here */
if (zend_hash_num_elements(&bp_types)) {
- sdlTypePtr **tmp, *ptype = NULL;
+ sdlTypePtr *tmp, ptype = NULL;
- zend_hash_internal_pointer_reset(&bp_types);
- while (zend_hash_get_current_data(&bp_types, (void**)&tmp) == SUCCESS) {
- if (zend_hash_find(&ptr_map, (char*)(*tmp), sizeof(**tmp), (void**)&ptype) == FAILURE) {
+ ZEND_HASH_FOREACH_PTR(&bp_types, tmp) {
+ if ((ptype = zend_hash_str_find_ptr(&ptr_map, (char*)tmp, sizeof(*tmp))) == NULL) {
assert(0);
}
- **tmp = *ptype;
- zend_hash_move_forward(&bp_types);
- }
+ *tmp = ptype;
+ } ZEND_HASH_FOREACH_END();
}
if (zend_hash_num_elements(&bp_encoders)) {
- encodePtr **tmp, *penc = NULL;
+ encodePtr *tmp, penc = NULL;
- zend_hash_internal_pointer_reset(&bp_encoders);
- while (zend_hash_get_current_data(&bp_encoders, (void**)&tmp) == SUCCESS) {
- if (zend_hash_find(&ptr_map, (char*)(*tmp), sizeof(**tmp), (void**)&penc) == FAILURE) {
+ ZEND_HASH_FOREACH_PTR(&bp_encoders, tmp) {
+ if ((penc = zend_hash_str_find_ptr(&ptr_map, (char*)tmp, sizeof(*tmp))) == NULL) {
assert(0);
}
- **tmp = *penc;
- zend_hash_move_forward(&bp_encoders);
- }
+ *tmp = penc;
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->bindings) {
- sdlBindingPtr *tmp;
+ sdlBindingPtr tmp;
sdlBindingPtr pbind;
psdl->bindings = malloc(sizeof(HashTable));
zend_hash_init(psdl->bindings, zend_hash_num_elements(sdl->bindings), NULL, delete_binding_persistent, 1);
- zend_hash_internal_pointer_reset(sdl->bindings);
- while (zend_hash_get_current_data(sdl->bindings, (void **)&tmp) == SUCCESS) {
- pbind = make_persistent_sdl_binding(*tmp, &ptr_map);
- if (zend_hash_get_current_key_ex(sdl->bindings, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(psdl->bindings, key, key_len, (void*)&pbind, sizeof(sdlBindingPtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(sdl->bindings, key, tmp) {
+ pbind = make_persistent_sdl_binding(tmp, &ptr_map);
+ if (key) {
+ zend_hash_add_ptr(psdl->bindings, key, pbind);
} else {
- zend_hash_next_index_insert(psdl->bindings, (void*)&pbind, sizeof(sdlBindingPtr), NULL);
+ zend_hash_next_index_insert_ptr(psdl->bindings, pbind);
}
- zend_hash_add(&ptr_map, (char*)tmp, sizeof(*tmp), (void*)&pbind, sizeof(sdlBindingPtr), NULL);
- zend_hash_move_forward(sdl->bindings);
- }
+ zend_hash_str_add_ptr(&ptr_map, (char*)&tmp, sizeof(tmp), pbind);
+ } ZEND_HASH_FOREACH_END();
}
zend_hash_init(&psdl->functions, zend_hash_num_elements(&sdl->functions), NULL, delete_function_persistent, 1);
if (zend_hash_num_elements(&sdl->functions)) {
- sdlFunctionPtr *tmp;
+ sdlFunctionPtr tmp;
sdlFunctionPtr pfunc;
- zend_hash_internal_pointer_reset(&sdl->functions);
- while (zend_hash_get_current_data(&sdl->functions, (void **)&tmp) == SUCCESS) {
- pfunc = make_persistent_sdl_function(*tmp, &ptr_map);
- if (zend_hash_get_current_key_ex(&sdl->functions, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(&psdl->functions, key, key_len, (void*)&pfunc, sizeof(sdlFunctionPtr), NULL);
+ ZEND_HASH_FOREACH_STR_KEY_PTR(&sdl->functions, key, tmp) {
+ pfunc = make_persistent_sdl_function(tmp, &ptr_map);
+ if (key) {
+ zend_hash_add_ptr(&psdl->functions, key, pfunc);
} else {
- zend_hash_next_index_insert(&psdl->functions, (void*)&pfunc, sizeof(sdlFunctionPtr), NULL);
+ zend_hash_next_index_insert_ptr(&psdl->functions, pfunc);
}
- zend_hash_add(&ptr_map, (char*)tmp, sizeof(*tmp), (void*)&pfunc, sizeof(sdlFunctionPtr), NULL);
- zend_hash_move_forward(&sdl->functions);
- }
+ zend_hash_str_add_ptr(&ptr_map, (char*)&tmp, sizeof(tmp), pfunc);
+ } ZEND_HASH_FOREACH_END();
}
if (sdl->requests) {
- sdlFunctionPtr *tmp;
- sdlFunctionPtr *preq;
+ zval *zv;
+ sdlFunctionPtr tmp;
+ sdlFunctionPtr preq;
psdl->requests = malloc(sizeof(HashTable));
zend_hash_init(psdl->requests, zend_hash_num_elements(sdl->requests), NULL, NULL, 1);
- zend_hash_internal_pointer_reset(sdl->requests);
- while (zend_hash_get_current_data(sdl->requests, (void **)&tmp) == SUCCESS) {
- if (zend_hash_find(&ptr_map, (char*)tmp, sizeof(*tmp), (void**)&preq) == FAILURE) {
+ ZEND_HASH_FOREACH_STR_KEY_VAL(sdl->requests, key, zv) {
+ tmp = Z_PTR_P(zv);
+ if ((preq = zend_hash_str_find_ptr(&ptr_map, (char*)&tmp, sizeof(tmp))) == NULL) {
assert(0);
}
- *tmp = *preq;
- if (zend_hash_get_current_key_ex(sdl->requests, &key, &key_len, &index, 0, NULL) == HASH_KEY_IS_STRING) {
- zend_hash_add(psdl->requests, key, key_len, (void*)&preq, sizeof(sdlFunctionPtr), NULL);
+ //???
+ Z_PTR_P(zv) = preq;
+ if (key) {
+ zend_hash_add_ptr(psdl->requests, key, preq);
}
- zend_hash_move_forward(sdl->requests);
- }
+ } ZEND_HASH_FOREACH_END();
}
zend_hash_destroy(&ptr_map);
@@ -3147,9 +3094,8 @@ typedef struct _sdl_cache_bucket {
time_t time;
} sdl_cache_bucket;
-static void delete_psdl(void *data)
+static void delete_psdl_int(sdl_cache_bucket *p)
{
- sdl_cache_bucket *p = (sdl_cache_bucket*)data;
sdlPtr tmp = p->sdl;
zend_hash_destroy(&tmp->functions);
@@ -3186,6 +3132,11 @@ static void delete_psdl(void *data)
free(tmp);
}
+static void delete_psdl(zval *zv)
+{
+ delete_psdl_int(Z_PTR_P(zv));
+}
+
sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
{
char fn[MAXPATHLEN];
@@ -3193,13 +3144,15 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
char* old_error_code = SOAP_GLOBAL(error_code);
int uri_len = 0;
php_stream_context *context=NULL;
- zval **tmp, **proxy_host, **proxy_port, *orig_context = NULL, *new_context = NULL;
+ zval *tmp, *proxy_host, *proxy_port, orig_context, new_context;
smart_str headers = {0};
char* key = NULL;
time_t t = time(0);
zend_bool has_proxy_authorization = 0;
zend_bool has_authorization = 0;
+ ZVAL_UNDEF(&orig_context);
+ ZVAL_UNDEF(&new_context);
if (strchr(uri,':') != NULL || IS_ABSOLUTE_PATH(uri, uri_len)) {
uri_len = strlen(uri);
} else if (VCWD_REALPATH(uri, fn) == NULL) {
@@ -3212,10 +3165,10 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
if ((cache_wsdl & WSDL_CACHE_MEMORY) && SOAP_GLOBAL(mem_cache)) {
sdl_cache_bucket *p;
- if (SUCCESS == zend_hash_find(SOAP_GLOBAL(mem_cache), uri, uri_len+1, (void*)&p)) {
+ if (NULL != (p = zend_hash_str_find_ptr(SOAP_GLOBAL(mem_cache), uri, uri_len))) {
if (p->time < t - SOAP_GLOBAL(cache_ttl)) {
/* in-memory cache entry is expired */
- zend_hash_del(&EG(persistent_list), uri, uri_len+1);
+ zend_hash_str_del(&EG(persistent_list), uri, uri_len);
} else {
return p->sdl;
}
@@ -3255,51 +3208,47 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
}
}
- if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr),
- "_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
- context = php_stream_context_from_zval(*tmp, 0);
+ if (NULL != (tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr),
+ "_stream_context", sizeof("_stream_context")-1))) {
+ context = php_stream_context_from_zval(tmp, 0);
} else {
context = php_stream_context_alloc(TSRMLS_C);
}
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **) &tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING && Z_STRLEN_PP(tmp) > 0) {
+ if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL &&
+ Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) {
smart_str_appends(&headers, "User-Agent: ");
- smart_str_appends(&headers, Z_STRVAL_PP(tmp));
+ smart_str_appends(&headers, Z_STRVAL_P(tmp));
smart_str_appends(&headers, "\r\n");
}
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS &&
- Z_TYPE_PP(proxy_host) == IS_STRING &&
- zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port"), (void **) &proxy_port) == SUCCESS &&
- Z_TYPE_PP(proxy_port) == IS_LONG) {
- zval str_port, *str_proxy;
+ if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL &&
+ Z_TYPE_P(proxy_host) == IS_STRING &&
+ (proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL &&
+ Z_TYPE_P(proxy_port) == IS_LONG) {
+ zval str_port, str_proxy;
smart_str proxy = {0};
- str_port = **proxy_port;
- zval_copy_ctor(&str_port);
+ ZVAL_DUP(&str_port, proxy_port);
convert_to_string(&str_port);
smart_str_appends(&proxy,"tcp://");
- smart_str_appends(&proxy,Z_STRVAL_PP(proxy_host));
+ smart_str_appends(&proxy,Z_STRVAL_P(proxy_host));
smart_str_appends(&proxy,":");
smart_str_appends(&proxy,Z_STRVAL(str_port));
smart_str_0(&proxy);
zval_dtor(&str_port);
- MAKE_STD_ZVAL(str_proxy);
- ZVAL_STRING(str_proxy, proxy.c, 1);
+ ZVAL_STR(&str_proxy, STR_COPY(proxy.s));
smart_str_free(&proxy);
if (!context) {
context = php_stream_context_alloc(TSRMLS_C);
}
- php_stream_context_set_option(context, "http", "proxy", str_proxy);
+ php_stream_context_set_option(context, "http", "proxy", &str_proxy);
zval_ptr_dtor(&str_proxy);
if (uri_len < sizeof("https://")-1 ||
strncasecmp(uri, "https://", sizeof("https://")-1) != 0) {
- MAKE_STD_ZVAL(str_proxy);
- ZVAL_BOOL(str_proxy, 1);
- php_stream_context_set_option(context, "http", "request_fulluri", str_proxy);
- zval_ptr_dtor(&str_proxy);
+ ZVAL_TRUE(&str_proxy);
+ php_stream_context_set_option(context, "http", "request_fulluri", &str_proxy);
}
has_proxy_authorization = proxy_authentication(this_ptr, &headers TSRMLS_CC);
@@ -3308,17 +3257,16 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
has_authorization = basic_authentication(this_ptr, &headers TSRMLS_CC);
/* Use HTTP/1.1 with "Connection: close" by default */
- if (php_stream_context_get_option(context, "http", "protocol_version", &tmp) == FAILURE) {
- zval *http_version;
- MAKE_STD_ZVAL(http_version);
- ZVAL_DOUBLE(http_version, 1.1);
- php_stream_context_set_option(context, "http", "protocol_version", http_version);
- zval_ptr_dtor(&http_version);
+ if ((tmp = php_stream_context_get_option(context, "http", "protocol_version")) == NULL) {
+ zval http_version;
+
+ ZVAL_DOUBLE(&http_version, 1.1);
+ php_stream_context_set_option(context, "http", "protocol_version", &http_version);
smart_str_appendl(&headers, "Connection: close\r\n", sizeof("Connection: close\r\n")-1);
}
- if (headers.len > 0) {
- zval *str_headers;
+ if (headers.s && headers.s->len > 0) {
+ zval str_headers;
if (!context) {
context = php_stream_context_alloc(TSRMLS_C);
@@ -3327,17 +3275,15 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
}
smart_str_0(&headers);
- MAKE_STD_ZVAL(str_headers);
- ZVAL_STRING(str_headers, headers.c, 1);
- php_stream_context_set_option(context, "http", "header", str_headers);
+ ZVAL_STR(&str_headers, STR_COPY(headers.s));
+ php_stream_context_set_option(context, "http", "header", &str_headers);
smart_str_free(&headers);
zval_ptr_dtor(&str_headers);
}
if (context) {
- MAKE_STD_ZVAL(new_context);
- php_stream_context_to_zval(context, new_context);
- orig_context = php_libxml_switch_context(new_context TSRMLS_CC);
+ php_stream_context_to_zval(context, &new_context);
+ php_libxml_switch_context(&new_context, &orig_context TSRMLS_CC);
}
SOAP_GLOBAL(error_code) = "WSDL";
@@ -3350,7 +3296,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
SOAP_GLOBAL(error_code) = old_error_code;
if (context) {
- php_libxml_switch_context(orig_context TSRMLS_CC);
+ php_libxml_switch_context(&orig_context, NULL TSRMLS_CC);
zval_ptr_dtor(&new_context);
}
@@ -3374,22 +3320,17 @@ cache_in_memory:
SOAP_GLOBAL(cache_limit) <= zend_hash_num_elements(SOAP_GLOBAL(mem_cache))) {
/* in-memory cache overflow */
sdl_cache_bucket *q;
- HashPosition pos;
time_t latest = t;
- char *key = NULL;
- uint key_len;
- ulong idx;
+ zend_string *latest_key = NULL, *key;
- for (zend_hash_internal_pointer_reset_ex(SOAP_GLOBAL(mem_cache), &pos);
- zend_hash_get_current_data_ex(SOAP_GLOBAL(mem_cache), (void **) &q, &pos) == SUCCESS;
- zend_hash_move_forward_ex(SOAP_GLOBAL(mem_cache), &pos)) {
+ ZEND_HASH_FOREACH_STR_KEY_PTR(SOAP_GLOBAL(mem_cache), key, q) {
if (q->time < latest) {
latest = q->time;
- zend_hash_get_current_key_ex(SOAP_GLOBAL(mem_cache), &key, &key_len, &idx, 0, &pos);
+ latest_key = key;
}
- }
- if (key) {
- zend_hash_del(SOAP_GLOBAL(mem_cache), key, key_len);
+ } ZEND_HASH_FOREACH_END();
+ if (latest_key) {
+ zend_hash_del(SOAP_GLOBAL(mem_cache), latest_key);
} else {
return sdl;
}
@@ -3400,8 +3341,8 @@ cache_in_memory:
p.time = t;
p.sdl = psdl;
- if (SUCCESS == zend_hash_update(SOAP_GLOBAL(mem_cache), uri,
- uri_len+1, (void*)&p, sizeof(sdl_cache_bucket), NULL)) {
+ if (NULL != zend_hash_str_update_mem(SOAP_GLOBAL(mem_cache), uri,
+ uri_len, &p, sizeof(sdl_cache_bucket))) {
/* remove non-persitent sdl structure */
delete_sdl_impl(sdl);
/* and replace it with persistent one */
@@ -3409,7 +3350,7 @@ cache_in_memory:
} else {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed to register persistent entry");
/* clean up persistent sdl */
- delete_psdl(&p);
+ delete_psdl_int(&p);
/* keep non-persistent sdl and return it */
}
}
@@ -3466,9 +3407,9 @@ void delete_sdl(void *handle)
}
}
-static void delete_binding(void *data)
+static void delete_binding(zval *zv)
{
- sdlBindingPtr binding = *((sdlBindingPtr*)data);
+ sdlBindingPtr binding = Z_PTR_P(zv);
if (binding->location) {
efree(binding->location);
@@ -3486,9 +3427,9 @@ static void delete_binding(void *data)
efree(binding);
}
-static void delete_binding_persistent(void *data)
+static void delete_binding_persistent(zval *zv)
{
- sdlBindingPtr binding = *((sdlBindingPtr*)data);
+ sdlBindingPtr binding = Z_PTR_P(zv);
if (binding->location) {
free(binding->location);
@@ -3528,9 +3469,9 @@ static void delete_sdl_soap_binding_function_body_persistent(sdlSoapBindingFunct
}
}
-static void delete_function(void *data)
+static void delete_function(zval *zv)
{
- sdlFunctionPtr function = *((sdlFunctionPtr*)data);
+ sdlFunctionPtr function = Z_PTR_P(zv);
if (function->functionName) {
efree(function->functionName);
@@ -3567,9 +3508,9 @@ static void delete_function(void *data)
efree(function);
}
-static void delete_function_persistent(void *data)
+static void delete_function_persistent(zval *zv)
{
- sdlFunctionPtr function = *((sdlFunctionPtr*)data);
+ sdlFunctionPtr function = Z_PTR_P(zv);
if (function->functionName) {
free(function->functionName);
@@ -3606,27 +3547,26 @@ static void delete_function_persistent(void *data)
free(function);
}
-static void delete_parameter(void *data)
+static void delete_parameter(zval *zv)
{
- sdlParamPtr param = *((sdlParamPtr*)data);
+ sdlParamPtr param = Z_PTR_P(zv);
if (param->paramName) {
efree(param->paramName);
}
efree(param);
}
-static void delete_parameter_persistent(void *data)
+static void delete_parameter_persistent(zval *zv)
{
- sdlParamPtr param = *((sdlParamPtr*)data);
+ sdlParamPtr param = Z_PTR_P(zv);
if (param->paramName) {
free(param->paramName);
}
free(param);
}
-static void delete_header(void *data)
+static void delete_header_int(sdlSoapBindingFunctionHeaderPtr hdr)
{
- sdlSoapBindingFunctionHeaderPtr hdr = *((sdlSoapBindingFunctionHeaderPtr*)data);
if (hdr->name) {
efree(hdr->name);
}
@@ -3640,9 +3580,14 @@ static void delete_header(void *data)
efree(hdr);
}
-static void delete_header_persistent(void *data)
+static void delete_header(zval *zv)
+{
+ delete_header_int(Z_PTR_P(zv));
+}
+
+static void delete_header_persistent(zval *zv)
{
- sdlSoapBindingFunctionHeaderPtr hdr = *((sdlSoapBindingFunctionHeaderPtr*)data);
+ sdlSoapBindingFunctionHeaderPtr hdr = Z_PTR_P(zv);
if (hdr->name) {
free(hdr->name);
}
@@ -3656,9 +3601,9 @@ static void delete_header_persistent(void *data)
free(hdr);
}
-static void delete_fault(void *data)
+static void delete_fault(zval *zv)
{
- sdlFaultPtr fault = *((sdlFaultPtr*)data);
+ sdlFaultPtr fault = Z_PTR_P(zv);
if (fault->name) {
efree(fault->name);
}
@@ -3677,9 +3622,9 @@ static void delete_fault(void *data)
efree(fault);
}
-static void delete_fault_persistent(void *data)
+static void delete_fault_persistent(zval *zv)
{
- sdlFaultPtr fault = *((sdlFaultPtr*)data);
+ sdlFaultPtr fault = Z_PTR_P(zv);
if (fault->name) {
free(fault->name);
}
@@ -3698,9 +3643,9 @@ static void delete_fault_persistent(void *data)
free(fault);
}
-static void delete_document(void *doc_ptr)
+static void delete_document(zval *zv)
{
- xmlDocPtr doc = *((xmlDocPtr*)doc_ptr);
+ xmlDocPtr doc = Z_PTR_P(zv);
xmlFreeDoc(doc);
}