if (Z_TYPE_P(data) == IS_ARRAY) {
sdlAttributePtr *arrayType;
- xmlAttrPtr *arrayTypeAttr;
+ sdlExtraAttributePtr *ext;
sdlTypePtr elementType;
i = zend_hash_num_elements(Z_ARRVAL_P(data));
zend_hash_find(sdl_type->attributes, SOAP_1_1_ENC_NAMESPACE":arrayType",
sizeof(SOAP_1_1_ENC_NAMESPACE":arrayType"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&arrayTypeAttr) == SUCCESS) {
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&ext) == SUCCESS) {
- char *ns = NULL, *value, *end;
- xmlNsPtr myNs;
+ char *value, *end;
zval** el;
- parse_namespace((*arrayTypeAttr)->children->content, &value, &ns);
- myNs = xmlSearchNs((*arrayTypeAttr)->doc, (*arrayTypeAttr)->parent, ns);
-
+ value = estrdup((*ext)->val);
end = strrchr(value,'[');
if (end) {
*end = '\0';
end++;
dimension = calc_dimension(end);
}
- if (myNs != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), myNs->href, value);
- get_type_str(xmlParam, myNs->href, value, &array_type);
+ if ((*ext)->ns != NULL) {
+ enc = get_encoder(SOAP_GLOBAL(sdl), (*ext)->ns, value);
+ get_type_str(xmlParam, (*ext)->ns, value, &array_type);
} else {
smart_str_appends(&array_type, value);
}
}
efree(value);
- if (ns) efree(ns);
} else if (sdl_type &&
sdl_type->attributes &&
zend_hash_find(sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":itemType",
sizeof(SOAP_1_2_ENC_NAMESPACE":itemType"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":itemType", sizeof(WSDL_NAMESPACE":itemType"), (void **)&arrayTypeAttr) == SUCCESS) {
- char *name, *ns;
- xmlNsPtr nsptr;
- xmlAttrPtr attr;
-
- attr = *arrayTypeAttr;
- parse_namespace(attr->children->content, &name, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
-
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, name);
- get_type_str(xmlParam, nsptr->href, name, &array_type);
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":itemType", sizeof(WSDL_NAMESPACE":itemType"), (void **)&ext) == SUCCESS) {
+ if ((*ext)->ns != NULL) {
+ enc = get_encoder(SOAP_GLOBAL(sdl), (*ext)->ns, (*ext)->val);
+ get_type_str(xmlParam, (*ext)->ns, (*ext)->val, &array_type);
} else {
- smart_str_appends(&array_type, name);
+ smart_str_appends(&array_type, (*ext)->val);
}
- efree(name);
- if (ns) {efree(ns);}
if (zend_hash_find(sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&arrayTypeAttr) == SUCCESS) {
- attr = *arrayTypeAttr;
-
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&ext) == SUCCESS) {
+ dimension = calc_dimension_12((*ext)->val);
+ dims = get_position_12(dimension, (*ext)->val);
if (dims[0] == 0) {dims[0] = i;}
smart_str_append_long(&array_size, dims[0]);
zend_hash_find(sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraySize"), (void **)&arrayTypeAttr) == SUCCESS) {
- xmlAttrPtr attr;
-
- attr = *arrayTypeAttr;
-
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraySize"), (void **)&ext) == SUCCESS) {
+ dimension = calc_dimension_12((*ext)->val);
+ dims = get_position_12(dimension, (*ext)->val);
if (dims[0] == 0) {dims[0] = i;}
smart_str_append_long(&array_size, dims[0]);
int dimension = 1;
int* dims = NULL;
int* pos = NULL;
- xmlAttrPtr attr, *tmp;
+ xmlAttrPtr attr;
sdlPtr sdl;
sdlAttributePtr *arrayType;
+ sdlExtraAttributePtr *ext;
sdlTypePtr elementType;
TSRMLS_FETCH();
zend_hash_find(type->sdl_type->attributes, SOAP_1_1_ENC_NAMESPACE":arrayType",
sizeof(SOAP_1_1_ENC_NAMESPACE":arrayType"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&tmp) == SUCCESS) {
- char *type, *end, *ns;
- xmlNsPtr nsptr;
-
- attr = *tmp;
- parse_namespace(attr->children->content, &type, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arrayType", sizeof(WSDL_NAMESPACE":arrayType"), (void **)&ext) == SUCCESS) {
+ char *type, *end;
+ type = estrdup((*ext)->val);
end = strrchr(type,'[');
if (end) {
*end = '\0';
}
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, type);
+ if ((*ext)->ns != NULL) {
+ enc = get_encoder(SOAP_GLOBAL(sdl), (*ext)->ns, type);
}
efree(type);
- if (ns) {efree(ns);}
+
dims = emalloc(sizeof(int));
*dims = 0;
zend_hash_find(type->sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":itemType",
sizeof(SOAP_1_2_ENC_NAMESPACE":itemType"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":itemType", sizeof(WSDL_NAMESPACE":itemType"), (void **)&tmp) == SUCCESS) {
-
- char *name, *ns;
- xmlNsPtr nsptr;
-
- attr = *tmp;
- parse_namespace(attr->children->content, &name, &ns);
- nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":itemType", sizeof(WSDL_NAMESPACE":itemType"), (void **)&ext) == SUCCESS) {
- if (nsptr != NULL) {
- enc = get_encoder(SOAP_GLOBAL(sdl), nsptr->href, name);
+ if ((*ext)->ns != NULL) {
+ enc = get_encoder(SOAP_GLOBAL(sdl), (*ext)->ns, (*ext)->val);
}
- efree(name);
- if (ns) {efree(ns);}
if (zend_hash_find(type->sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&tmp) == SUCCESS) {
- attr = *tmp;
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&ext) == SUCCESS) {
+ dimension = calc_dimension_12((*ext)->val);
+ dims = get_position_12(dimension, (*ext)->val);
} else {
dims = emalloc(sizeof(int));
*dims = 0;
zend_hash_find(type->sdl_type->attributes, SOAP_1_2_ENC_NAMESPACE":arraySize",
sizeof(SOAP_1_2_ENC_NAMESPACE":arraySize"),
(void **)&arrayType) == SUCCESS &&
- zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&tmp) == SUCCESS) {
+ zend_hash_find((*arrayType)->extraAttributes, WSDL_NAMESPACE":arraySize", sizeof(WSDL_NAMESPACE":arraysize"), (void **)&ext) == SUCCESS) {
- attr = *tmp;
- dimension = calc_dimension_12(attr->children->content);
- dims = get_position_12(dimension, attr->children->content);
+ dimension = calc_dimension_12((*ext)->val);
+ dims = get_position_12(dimension, (*ext)->val);
if (type->sdl_type && type->sdl_type->elements &&
zend_hash_num_elements(type->sdl_type->elements) == 1 &&
(elementType = *(sdlTypePtr*)type->sdl_type->elements->pListHead->pData) != NULL &&
char* prefix;
TSRMLS_FETCH();
- if (zend_hash_find(SOAP_GLOBAL(defEncNs), (char*)ns, strlen(ns) + 1, (void **)&prefix) == SUCCESS) {
+ if (zend_hash_find(&SOAP_GLOBAL(defEncNs), (char*)ns, strlen(ns) + 1, (void **)&prefix) == SUCCESS) {
xmlns = xmlNewNs(node->doc->children,ns,prefix);
} else {
smart_str prefix = {0};
static int schema_group(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr groupType, sdlTypePtr cur_type, sdlContentModelPtr model);
static int schema_any(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr extType, sdlTypePtr cur_type, sdlContentModelPtr model);
static int schema_element(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr cur_type, sdlContentModelPtr model);
-static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
-static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type);
+static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type, sdlCtx *ctx);
+static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type, sdlCtx *ctx);
static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valptr);
static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *valptr);
-static void schema_type_fixup(sdlPtr sdl, sdlTypePtr type);
+static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type);
static void delete_model(void *handle);
static void delete_type(void *data);
+static void delete_extra_attribute(void *attribute);
static void delete_attribute(void *attribute);
static void delete_restriction_var_int(void *rvi);
static void delete_schema_restriction_var_char(void *srvc);
return enc;
}
-static void schema_load_file(sdlPtr sdl, xmlAttrPtr ns, xmlChar *location, xmlAttrPtr tns, int import) {
+static void schema_load_file(sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, xmlAttrPtr tns, int import) {
if (location != NULL &&
- !zend_hash_exists(&sdl->docs, location, strlen(location)+1)) {
+ !zend_hash_exists(&ctx->docs, location, strlen(location)+1)) {
xmlDocPtr doc;
xmlNodePtr schema;
xmlAttrPtr new_tns;
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't include schema from '%s', different 'targetNamespace'",location);
}
}
- zend_hash_add(&sdl->docs, location, strlen(location)+1, (void**)&doc, sizeof(xmlDocPtr), NULL);
- load_schema(sdl, schema);
+ zend_hash_add(&ctx->docs, location, strlen(location)+1, (void**)&doc, sizeof(xmlDocPtr), NULL);
+ load_schema(ctx, schema);
}
}
Content: ((include | import | redefine | annotation)*, (((simpleType | complexType | group | attributeGroup) | element | attribute | notation), annotation*)*)
</schema>
*/
-int load_schema(sdlPtr sdl,xmlNodePtr schema)
+int load_schema(sdlCtx *ctx,xmlNodePtr schema)
{
xmlNodePtr trav;
xmlAttrPtr tns;
- if (!sdl->types) {
- sdl->types = malloc(sizeof(HashTable));
- zend_hash_init(sdl->types, 0, NULL, delete_type, 1);
+ if (!ctx->sdl->types) {
+ ctx->sdl->types = malloc(sizeof(HashTable));
+ zend_hash_init(ctx->sdl->types, 0, NULL, delete_type, 1);
}
- if (!sdl->elements) {
- sdl->elements = malloc(sizeof(HashTable));
- zend_hash_init(sdl->elements, 0, NULL, delete_type, 1);
+ if (!ctx->attributes) {
+ ctx->attributes = emalloc(sizeof(HashTable));
+ zend_hash_init(ctx->attributes, 0, NULL, delete_attribute, 0);
+ }
+ if (!ctx->attributeGroups) {
+ ctx->attributeGroups = emalloc(sizeof(HashTable));
+ zend_hash_init(ctx->attributeGroups, 0, NULL, delete_type, 0);
}
tns = get_attribute(schema->properties, "targetNamespace");
uri = xmlBuildURI(location->children->content, base);
xmlFree(base);
}
- schema_load_file(sdl,NULL,uri,tns,0);
+ schema_load_file(ctx,NULL,uri,tns,0);
xmlFree(uri);
}
uri = xmlBuildURI(location->children->content, base);
xmlFree(base);
}
- schema_load_file(sdl,NULL,uri,tns,0);
+ schema_load_file(ctx,NULL,uri,tns,0);
xmlFree(uri);
/* TODO: <redefine> support */
}
xmlFree(base);
}
}
- schema_load_file(sdl,ns,uri,tns,1);
+ schema_load_file(ctx,ns,uri,tns,1);
if (uri != NULL) {xmlFree(uri);}
} else if (node_is_equal(trav,"annotation")) {
/* TODO: <annotation> support */
while (trav != NULL) {
if (node_is_equal(trav,"simpleType")) {
- schema_simpleType(sdl, tns, trav, NULL);
+ schema_simpleType(ctx->sdl, tns, trav, NULL);
} else if (node_is_equal(trav,"complexType")) {
- schema_complexType(sdl, tns, trav, NULL);
+ schema_complexType(ctx->sdl, tns, trav, NULL);
} else if (node_is_equal(trav,"group")) {
- schema_group(sdl, tns, trav, NULL, NULL);
+ schema_group(ctx->sdl, tns, trav, NULL, NULL);
} else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tns, trav, NULL);
+ schema_attributeGroup(ctx->sdl, tns, trav, NULL, ctx);
} else if (node_is_equal(trav,"element")) {
- schema_element(sdl, tns, trav, NULL, NULL);
+ schema_element(ctx->sdl, tns, trav, NULL, NULL);
} else if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tns, trav, NULL);
+ schema_attribute(ctx->sdl, tns, trav, NULL, ctx);
} else if (node_is_equal(trav,"notation")) {
/* TODO: <notation> support */
} else if (node_is_equal(trav,"annotation")) {
if (!simpleType) {
while (trav != NULL) {
if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
+ schema_attribute(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
+ schema_attributeGroup(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"anyAttribute")) {
/* TODO: <anyAttribute> support */
trav = trav->next;
}
while (trav != NULL) {
if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
+ schema_attribute(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
+ schema_attributeGroup(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"anyAttribute")) {
/* TODO: <anyAttribute> support */
trav = trav->next;
}
while (trav != NULL) {
if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
+ schema_attribute(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
+ schema_attributeGroup(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"anyAttribute")) {
/* TODO: <anyAttribute> support */
trav = trav->next;
}
while (trav != NULL) {
if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
+ schema_attribute(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
+ schema_attributeGroup(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"anyAttribute")) {
/* TODO: <anyAttribute> support */
trav = trav->next;
}
while (trav != NULL) {
if (node_is_equal(trav,"attribute")) {
- schema_attribute(sdl, tsn, trav, cur_type);
+ schema_attribute(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"attributeGroup")) {
- schema_attributeGroup(sdl, tsn, trav, cur_type);
+ schema_attributeGroup(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"anyAttribute")) {
/* TODO: <anyAttribute> support */
trav = trav->next;
newType->nillable = FALSE;
if (cur_type == NULL) {
+ if (sdl->elements == NULL) {
+ sdl->elements = malloc(sizeof(HashTable));
+ zend_hash_init(sdl->elements, 0, NULL, delete_type, 1);
+ }
addHash = sdl->elements;
smart_str_appends(&key, newType->namens);
smart_str_appendc(&key, ':');
Content: (annotation?, (simpleType?))
</attribute>
*/
-static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type)
+static int schema_attribute(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrType, sdlTypePtr cur_type, sdlCtx *ctx)
{
sdlAttributePtr newAttr;
xmlAttrPtr attr, name, ref = NULL, type = NULL;
}
if (cur_type == NULL) {
- if (sdl->attributes == NULL) {
- sdl->attributes = malloc(sizeof(HashTable));
- zend_hash_init(sdl->attributes, 0, NULL, delete_attribute, 1);
- }
- addHash = sdl->attributes;
+ addHash = ctx->attributes;
} else {
if (cur_type->attributes == NULL) {
cur_type->attributes = malloc(sizeof(HashTable));
if (strncmp(nsPtr->href, SCHEMA_NAMESPACE, sizeof(SCHEMA_NAMESPACE))) {
smart_str key2 = {0};
+ sdlExtraAttributePtr ext;
+ xmlNsPtr nsptr;
+ char *value, *ns;
+
+ ext = malloc(sizeof(sdlExtraAttribute));
+ memset(ext, 0, sizeof(sdlExtraAttribute));
+ parse_namespace(attr->children->content, &value, &ns);
+ nsptr = xmlSearchNs(attr->doc, attr->parent, ns);
+ if (nsptr) {
+ ext->ns = strdup(nsptr->href);
+ ext->val = strdup(value);
+ } else {
+ ext->val = strdup(attr->children->content);
+ }
+ if (ns) {efree(ns);}
+ efree(value);
if (!newAttr->extraAttributes) {
newAttr->extraAttributes = malloc(sizeof(HashTable));
- zend_hash_init(newAttr->extraAttributes, 0, NULL, NULL, 1);
+ zend_hash_init(newAttr->extraAttributes, 0, NULL, delete_extra_attribute, 1);
}
smart_str_appends(&key2, nsPtr->href);
smart_str_appendc(&key2, ':');
smart_str_appends(&key2, attr->name);
smart_str_0(&key2);
- zend_hash_add(newAttr->extraAttributes, key2.c, key2.len + 1, &attr, sizeof(xmlAttrPtr), NULL);
+ zend_hash_add(newAttr->extraAttributes, key2.c, key2.len + 1, &ext, sizeof(sdlExtraAttributePtr), NULL);
smart_str_free(&key2);
}
}
return TRUE;
}
-static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrGroup, sdlTypePtr cur_type)
+static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tsn, xmlNodePtr attrGroup, sdlTypePtr cur_type, sdlCtx *ctx)
{
xmlNodePtr trav;
xmlAttrPtr name, ref = NULL;
sdlTypePtr newType;
smart_str key = {0};
- if (sdl->attributeGroups == NULL) {
- sdl->attributeGroups = malloc(sizeof(HashTable));
- zend_hash_init(sdl->attributeGroups, 0, NULL, delete_type, 1);
- }
-
ns = get_attribute(attrGroup->properties, "targetNamespace");
if (ns == NULL) {
ns = tsn;
smart_str_appends(&key, newType->name);
smart_str_0(&key);
- if (zend_hash_add(sdl->attributeGroups, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
+ if (zend_hash_add(ctx->attributeGroups, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) {
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup '%s' already defined", key.c);
}
cur_type = newType;
if (ref != NULL) {
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
}
- schema_attribute(sdl, tsn, trav, cur_type);
+ schema_attribute(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"attributeGroup")) {
if (ref != NULL) {
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
}
- schema_attributeGroup(sdl, tsn, trav, cur_type);
+ schema_attributeGroup(sdl, tsn, trav, cur_type, NULL);
} else if (node_is_equal(trav,"anyAttribute")) {
if (ref != NULL) {
php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute");
return TRUE;
}
-static void schema_attribute_fixup(sdlPtr sdl, sdlAttributePtr attr)
+static void copy_extra_attribute(void *attribute)
+{
+ sdlExtraAttributePtr *attr = (sdlExtraAttributePtr*)attribute;
+ sdlExtraAttributePtr new_attr;
+
+ new_attr = malloc(sizeof(sdlExtraAttribute));
+ memcpy(new_attr, *attr, sizeof(sdlExtraAttribute));
+ *attr = new_attr;
+ if (new_attr->ns) {
+ new_attr->ns = strdup(new_attr->ns);
+ }
+ if (new_attr->val) {
+ new_attr->val = strdup(new_attr->val);
+ }
+}
+
+static void schema_attribute_fixup(sdlCtx *ctx, sdlAttributePtr attr)
{
sdlAttributePtr *tmp;
if (attr->ref != NULL) {
- if (sdl->attributes != NULL) {
- if (zend_hash_find(sdl->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
- schema_attribute_fixup(sdl, *tmp);
+ if (ctx->attributes != NULL) {
+ if (zend_hash_find(ctx->attributes, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
+ schema_attribute_fixup(ctx, *tmp);
if ((*tmp)->name != NULL && attr->name == NULL) {
attr->name = strdup((*tmp)->name);
}
xmlNodePtr node;
attr->extraAttributes = malloc(sizeof(HashTable));
-
- zend_hash_init(attr->extraAttributes, 0, NULL, NULL, 1);
- zend_hash_copy(attr->extraAttributes, (*tmp)->extraAttributes, NULL, &node, sizeof(xmlNodePtr));
+ zend_hash_init(attr->extraAttributes, 0, NULL, delete_extra_attribute, 1);
+ zend_hash_copy(attr->extraAttributes, (*tmp)->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr));
}
attr->encode = (*tmp)->encode;
}
}
}
-static void schema_attributegroup_fixup(sdlPtr sdl, sdlAttributePtr attr, HashTable *ht)
+static void schema_attributegroup_fixup(sdlCtx *ctx, sdlAttributePtr attr, HashTable *ht)
{
sdlTypePtr *tmp;
sdlAttributePtr *tmp_attr;
if (attr->ref != NULL) {
- if (sdl->attributeGroups != NULL) {
- if (zend_hash_find(sdl->attributeGroups, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
+ if (ctx->attributeGroups != NULL) {
+ if (zend_hash_find(ctx->attributeGroups, attr->ref, strlen(attr->ref)+1, (void**)&tmp) == SUCCESS) {
if ((*tmp)->attributes) {
zend_hash_internal_pointer_reset((*tmp)->attributes);
while (zend_hash_get_current_data((*tmp)->attributes,(void**)&tmp_attr) == SUCCESS) {
uint key_len;
sdlAttributePtr newAttr;
- schema_attribute_fixup(sdl,*tmp_attr);
+ schema_attribute_fixup(ctx,*tmp_attr);
newAttr = malloc(sizeof(sdlAttribute));
memcpy(newAttr, *tmp_attr, sizeof(sdlAttribute));
if (newAttr->extraAttributes) {
xmlNodePtr node;
HashTable *ht = malloc(sizeof(HashTable));
-
- zend_hash_init(ht, 0, NULL, NULL, 1);
- zend_hash_copy(ht, newAttr->extraAttributes, NULL, &node, sizeof(xmlNodePtr));
+ zend_hash_init(ht, 0, NULL, delete_extra_attribute, 1);
+ zend_hash_copy(ht, newAttr->extraAttributes, copy_extra_attribute, &node, sizeof(xmlNodePtr));
newAttr->extraAttributes = ht;
}
} else {
ulong index;
- schema_attributegroup_fixup(sdl,*tmp_attr, ht);
+ schema_attributegroup_fixup(ctx,*tmp_attr, ht);
zend_hash_get_current_key((*tmp)->attributes, NULL, &index, 0);
zend_hash_index_del((*tmp)->attributes, index);
}
}
}
-static void schema_content_model_fixup(sdlPtr sdl, sdlContentModelPtr model)
+static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model)
{
switch (model->kind) {
case XSD_CONTENT_GROUP_REF: {
sdlTypePtr *tmp;
- if (sdl->groups && zend_hash_find(sdl->groups, model->u.group_ref, strlen(model->u.group_ref)+1, (void**)&tmp) == SUCCESS) {
- schema_type_fixup(sdl,*tmp);
+ if (ctx->sdl->groups && zend_hash_find(ctx->sdl->groups, model->u.group_ref, strlen(model->u.group_ref)+1, (void**)&tmp) == SUCCESS) {
+ schema_type_fixup(ctx,*tmp);
efree(model->u.group_ref);
model->kind = XSD_CONTENT_GROUP;
model->u.group = (*tmp)->model;
zend_hash_internal_pointer_reset(model->u.content);
while (zend_hash_get_current_data(model->u.content, (void**)&tmp) == SUCCESS) {
- schema_content_model_fixup(sdl, *tmp);
+ schema_content_model_fixup(ctx, *tmp);
zend_hash_move_forward(model->u.content);
}
break;
}
}
-static void schema_type_fixup(sdlPtr sdl, sdlTypePtr type)
+static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type)
{
sdlTypePtr *tmp;
sdlAttributePtr *attr;
if (type->ref != NULL) {
- if (sdl->elements != NULL) {
- if (zend_hash_find(sdl->elements, type->ref, strlen(type->ref)+1, (void**)&tmp) == SUCCESS) {
+ if (ctx->sdl->elements != NULL) {
+ if (zend_hash_find(ctx->sdl->elements, type->ref, strlen(type->ref)+1, (void**)&tmp) == SUCCESS) {
type->encode = (*tmp)->encode;
/* TODO: nillable */
} else {
if (type->elements) {
zend_hash_internal_pointer_reset(type->elements);
while (zend_hash_get_current_data(type->elements,(void**)&tmp) == SUCCESS) {
- schema_type_fixup(sdl,*tmp);
+ schema_type_fixup(ctx,*tmp);
zend_hash_move_forward(type->elements);
}
}
if (type->model) {
- schema_content_model_fixup(sdl, type->model);
+ schema_content_model_fixup(ctx, type->model);
}
if (type->attributes) {
zend_hash_internal_pointer_reset(type->attributes);
while (zend_hash_get_current_data(type->attributes,(void**)&attr) == SUCCESS) {
if (zend_hash_get_current_key_type(type->attributes) == HASH_KEY_IS_STRING) {
- schema_attribute_fixup(sdl,*attr);
+ schema_attribute_fixup(ctx,*attr);
zend_hash_move_forward(type->attributes);
} else {
ulong index;
- schema_attributegroup_fixup(sdl,*attr,type->attributes);
+ schema_attributegroup_fixup(ctx,*attr,type->attributes);
zend_hash_get_current_key(type->attributes, NULL, &index, 0);
zend_hash_index_del(type->attributes, index);
}
}
}
-int schema_pass2(sdlPtr sdl)
+void schema_pass2(sdlCtx *ctx)
{
+ sdlPtr sdl = ctx->sdl;
sdlAttributePtr *attr;
sdlTypePtr *type;
- if (sdl->attributes) {
- zend_hash_internal_pointer_reset(sdl->attributes);
- while (zend_hash_get_current_data(sdl->attributes,(void**)&attr) == SUCCESS) {
- schema_attribute_fixup(sdl,*attr);
- zend_hash_move_forward(sdl->attributes);
+ if (ctx->attributes) {
+ zend_hash_internal_pointer_reset(ctx->attributes);
+ while (zend_hash_get_current_data(ctx->attributes,(void**)&attr) == SUCCESS) {
+ schema_attribute_fixup(ctx,*attr);
+ zend_hash_move_forward(ctx->attributes);
}
}
- if (sdl->attributeGroups) {
- zend_hash_internal_pointer_reset(sdl->attributeGroups);
- while (zend_hash_get_current_data(sdl->attributeGroups,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
- zend_hash_move_forward(sdl->attributeGroups);
+ if (ctx->attributeGroups) {
+ zend_hash_internal_pointer_reset(ctx->attributeGroups);
+ while (zend_hash_get_current_data(ctx->attributeGroups,(void**)&type) == SUCCESS) {
+ schema_type_fixup(ctx,*type);
+ zend_hash_move_forward(ctx->attributeGroups);
}
}
if (sdl->elements) {
zend_hash_internal_pointer_reset(sdl->elements);
while (zend_hash_get_current_data(sdl->elements,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
+ schema_type_fixup(ctx,*type);
zend_hash_move_forward(sdl->elements);
}
}
if (sdl->groups) {
zend_hash_internal_pointer_reset(sdl->groups);
while (zend_hash_get_current_data(sdl->groups,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
+ schema_type_fixup(ctx,*type);
zend_hash_move_forward(sdl->groups);
}
}
if (sdl->types) {
zend_hash_internal_pointer_reset(sdl->types);
while (zend_hash_get_current_data(sdl->types,(void**)&type) == SUCCESS) {
- schema_type_fixup(sdl,*type);
+ schema_type_fixup(ctx,*type);
zend_hash_move_forward(sdl->types);
}
}
- return TRUE;
-}
-
-int schema_pass3(sdlPtr sdl)
-{
- if (sdl->attributes) {
- zend_hash_destroy(sdl->attributes);
- free(sdl->attributes);
- sdl->attributes = NULL;
+ if (ctx->attributes) {
+ zend_hash_destroy(ctx->attributes);
+ efree(ctx->attributes);
}
- if (sdl->attributeGroups) {
- zend_hash_destroy(sdl->attributeGroups);
- free(sdl->attributeGroups);
- sdl->attributeGroups = NULL;
+ if (ctx->attributeGroups) {
+ zend_hash_destroy(ctx->attributeGroups);
+ efree(ctx->attributeGroups);
}
- return TRUE;
}
static void delete_model(void *handle)
free(type);
}
+static void delete_extra_attribute(void *attribute)
+{
+ sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute);
+
+ if (attr->ns) {
+ free(attr->ns);
+ }
+ if (attr->val) {
+ free(attr->val);
+ }
+ free(attr);
+}
+
static void delete_attribute(void *attribute)
{
sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
zend_hash_destroy(attr->extraAttributes);
free(attr->extraAttributes);
}
+ free(attr);
}
static void delete_restriction_var_int(void *rvi)
#include "php_soap.h"
#include "libxml/uri.h"
-typedef struct sdlCtx {
- sdlPtr root;
- HashTable messages;
- HashTable bindings;
- HashTable portTypes;
- HashTable services;
-} sdlCtx;
-
static void delete_binding(void *binding);
static void delete_function(void *function);
static void delete_paramater(void *paramater);
sdlTypePtr ret = NULL;
TSRMLS_FETCH();
- if (sdl && sdl->elements) {
+ if (sdl->elements) {
xmlNsPtr nsptr;
char *ns, *cptype;
sdlTypePtr *sdl_type;
static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
{
- sdlPtr tmpsdl = ctx->root;
+ sdlPtr tmpsdl = ctx->sdl;
xmlDocPtr wsdl;
xmlNodePtr root, definitions, trav;
xmlAttrPtr targetNamespace;
- if (zend_hash_exists(&tmpsdl->docs, struri, strlen(struri)+1)) {
+ if (zend_hash_exists(&ctx->docs, struri, strlen(struri)+1)) {
return;
}
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't load from '%s'", struri);
}
- zend_hash_add(&tmpsdl->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
+ zend_hash_add(&ctx->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL);
root = wsdl->children;
definitions = get_node(root, "definitions");
if (include) {
xmlNodePtr schema = get_node(root, "schema");
if (schema) {
- load_schema(tmpsdl, schema);
+ load_schema(ctx, schema);
return;
}
}
xmlNodePtr schema;
FOREACHNODE(trav2, "schema", schema) {
- load_schema(tmpsdl, schema);
+ load_schema(ctx, schema);
}
ENDFOREACH(trav2);
tmp = get_attribute(part->properties, "type");
if (tmp != NULL) {
- h->encode = get_encoder_from_prefix(ctx->root, part, tmp->children->content);
+ h->encode = get_encoder_from_prefix(ctx->sdl, part, tmp->children->content);
} else {
tmp = get_attribute(part->properties, "element");
if (tmp != NULL) {
- h->element = get_element(ctx->root, part, tmp->children->content);
+ h->element = get_element(ctx->sdl, part, tmp->children->content);
if (h->element) {
h->encode = h->element->encode;
}
type = get_attribute(part->properties, "type");
if (type != NULL) {
- param->encode = get_encoder_from_prefix(ctx->root, part, type->children->content);
+ param->encode = get_encoder_from_prefix(ctx->sdl, part, type->children->content);
} else {
element = get_attribute(part->properties, "element");
if (element != NULL) {
- param->element = get_element(ctx->root, part, element->children->content);
+ param->element = get_element(ctx->sdl, part, element->children->content);
if (param->element) {
param->encode = param->element->encode;
}
sdlCtx ctx;
int i,n;
- ctx.root = malloc(sizeof(sdl));
- memset(ctx.root, 0, sizeof(sdl));
- ctx.root->source = strdup(struri);
- zend_hash_init(&ctx.root->docs, 0, NULL, delete_document, 1);
- zend_hash_init(&ctx.root->functions, 0, NULL, delete_function, 1);
+ memset(&ctx,0,sizeof(ctx));
+ ctx.sdl = malloc(sizeof(sdl));
+ memset(ctx.sdl, 0, sizeof(sdl));
+ ctx.sdl->source = strdup(struri);
+ zend_hash_init(&ctx.sdl->functions, 0, NULL, delete_function, 1);
+ zend_hash_init(&ctx.docs, 0, NULL, delete_document, 0);
zend_hash_init(&ctx.messages, 0, NULL, NULL, 0);
zend_hash_init(&ctx.bindings, 0, NULL, NULL, 0);
zend_hash_init(&ctx.portTypes, 0, NULL, NULL, 0);
zend_hash_init(&ctx.services, 0, NULL, NULL, 0);
load_wsdl_ex(struri,&ctx, 0);
- schema_pass2(ctx.root);
+ schema_pass2(&ctx);
n = zend_hash_num_elements(&ctx.services);
if (n > 0) {
char *tmp = estrdup(function->functionName);
int len = strlen(tmp);
- zend_hash_add(&ctx.root->functions, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL);
+ zend_hash_add(&ctx.sdl->functions, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL);
efree(tmp);
if (function->requestName != NULL && strcmp(function->requestName,function->functionName) != 0) {
- if (ctx.root->requests == NULL) {
- ctx.root->requests = malloc(sizeof(HashTable));
- zend_hash_init(ctx.root->requests, 0, NULL, NULL, 1);
+ if (ctx.sdl->requests == NULL) {
+ ctx.sdl->requests = malloc(sizeof(HashTable));
+ zend_hash_init(ctx.sdl->requests, 0, NULL, NULL, 1);
}
tmp = estrdup(function->requestName);
len = strlen(tmp);
- zend_hash_add(ctx.root->requests, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL);
+ zend_hash_add(ctx.sdl->requests, php_strtolower(tmp, len), len+1, &function, sizeof(sdlFunctionPtr), NULL);
efree(tmp);
}
}
}
ENDFOREACH(trav2);
- if (!ctx.root->bindings) {
- ctx.root->bindings = malloc(sizeof(HashTable));
- zend_hash_init(ctx.root->bindings, 0, NULL, delete_binding, 1);
+ if (!ctx.sdl->bindings) {
+ ctx.sdl->bindings = malloc(sizeof(HashTable));
+ zend_hash_init(ctx.sdl->bindings, 0, NULL, delete_binding, 1);
}
- zend_hash_add(ctx.root->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL);
+ zend_hash_add(ctx.sdl->bindings, tmpbinding->name, strlen(tmpbinding->name), &tmpbinding, sizeof(sdlBindingPtr), NULL);
}
ENDFOREACH(trav);
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't bind to service");
}
- schema_pass3(ctx.root);
zend_hash_destroy(&ctx.messages);
zend_hash_destroy(&ctx.bindings);
zend_hash_destroy(&ctx.portTypes);
zend_hash_destroy(&ctx.services);
+ zend_hash_destroy(&ctx.docs);
- return ctx.root;
+ return ctx.sdl;
}
sdlPtr get_sdl(char *uri)
{
sdlPtr tmp = *((sdlPtr*)handle);
- zend_hash_destroy(&tmp->docs);
zend_hash_destroy(&tmp->functions);
if (tmp->source) {
free(tmp->source);
if (tmp->target_ns) {
free(tmp->target_ns);
}
+ if (tmp->elements) {
+ zend_hash_destroy(tmp->elements);
+ free(tmp->elements);
+ }
if (tmp->encoders) {
zend_hash_destroy(tmp->encoders);
free(tmp->encoders);
zend_hash_destroy(tmp->types);
free(tmp->types);
}
- if (tmp->elements) {
- zend_hash_destroy(tmp->elements);
- free(tmp->elements);
- }
- if (tmp->attributes) {
- zend_hash_destroy(tmp->attributes);
- free(tmp->attributes);
- }
- if (tmp->attributeGroups) {
- zend_hash_destroy(tmp->attributeGroups);
- free(tmp->attributeGroups);
- }
if (tmp->groups) {
zend_hash_destroy(tmp->groups);
free(tmp->groups);
free(soapBind->transport);
}
}
+ free(binding);
}
static void delete_sdl_soap_binding_function_body(sdlSoapBindingFunctionBody body)
delete_sdl_soap_binding_function_body(soapFunction->output);
delete_sdl_soap_binding_function_body(soapFunction->falut);
}
+ free(function);
}
static void delete_paramater(void *data)
soap_globals->sdls = malloc(sizeof(HashTable));
zend_hash_init(soap_globals->sdls, 0, NULL, delete_sdl, 1);
- soap_globals->defEnc = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEnc, 0, NULL, NULL, 1);
-
- soap_globals->defEncIndex = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncIndex, 0, NULL, NULL, 1);
-
- soap_globals->defEncNs = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncNs, 0, NULL, NULL, 1);
-
- soap_globals->defEncPrefix = malloc(sizeof(HashTable));
- zend_hash_init(soap_globals->defEncPrefix, 0, NULL, NULL, 1);
+ zend_hash_init(&soap_globals->defEnc, 0, NULL, NULL, 1);
+ zend_hash_init(&soap_globals->defEncIndex, 0, NULL, NULL, 1);
+ zend_hash_init(&soap_globals->defEncNs, 0, NULL, NULL, 1);
soap_globals->overrides = NULL;
char *ns_type;
ns_type = emalloc(strlen(defaultEncoding[i].details.ns) + strlen(defaultEncoding[i].details.type_str) + 2);
sprintf(ns_type, "%s:%s", defaultEncoding[i].details.ns, defaultEncoding[i].details.type_str);
- zend_hash_add(soap_globals->defEnc, ns_type, strlen(ns_type) + 1, &enc, sizeof(encodePtr), NULL);
+ zend_hash_add(&soap_globals->defEnc, ns_type, strlen(ns_type) + 1, &enc, sizeof(encodePtr), NULL);
efree(ns_type);
} else {
- zend_hash_add(soap_globals->defEnc, defaultEncoding[i].details.type_str, strlen(defaultEncoding[i].details.type_str) + 1, &enc, sizeof(encodePtr), NULL);
+ zend_hash_add(&soap_globals->defEnc, defaultEncoding[i].details.type_str, strlen(defaultEncoding[i].details.type_str) + 1, &enc, sizeof(encodePtr), NULL);
}
}
/* Index everything by number */
- if (!zend_hash_index_exists(soap_globals->defEncIndex, defaultEncoding[i].details.type)) {
- zend_hash_index_update(soap_globals->defEncIndex, defaultEncoding[i].details.type, &enc, sizeof(encodePtr), NULL);
+ if (!zend_hash_index_exists(&soap_globals->defEncIndex, defaultEncoding[i].details.type)) {
+ zend_hash_index_update(&soap_globals->defEncIndex, defaultEncoding[i].details.type, &enc, sizeof(encodePtr), NULL);
}
i++;
} while (defaultEncoding[i].details.type != END_KNOWN_TYPES);
/* hash by namespace */
- zend_hash_add(soap_globals->defEncNs, XSD_1999_NAMESPACE, sizeof(XSD_1999_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, XSD_NAMESPACE, sizeof(XSD_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, SOAP_1_1_ENC_NAMESPACE, sizeof(SOAP_1_1_ENC_NAMESPACE), SOAP_1_1_ENC_NS_PREFIX, sizeof(SOAP_1_1_ENC_NS_PREFIX), NULL);
- zend_hash_add(soap_globals->defEncNs, SOAP_1_2_ENC_NAMESPACE, sizeof(SOAP_1_2_ENC_NAMESPACE), SOAP_1_2_ENC_NS_PREFIX, sizeof(SOAP_1_2_ENC_NS_PREFIX), NULL);
-
- /* and by prefix */
- zend_hash_add(soap_globals->defEncPrefix, XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), XSD_NAMESPACE, sizeof(XSD_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, SOAP_1_1_ENC_NS_PREFIX, sizeof(SOAP_1_1_ENC_NS_PREFIX), SOAP_1_1_ENC_NAMESPACE, sizeof(SOAP_1_1_ENC_NAMESPACE), NULL);
- zend_hash_add(soap_globals->defEncPrefix, SOAP_1_2_ENC_NS_PREFIX, sizeof(SOAP_1_2_ENC_NS_PREFIX), SOAP_1_2_ENC_NAMESPACE, sizeof(SOAP_1_2_ENC_NAMESPACE), NULL);
+ zend_hash_add(&soap_globals->defEncNs, XSD_1999_NAMESPACE, sizeof(XSD_1999_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
+ zend_hash_add(&soap_globals->defEncNs, XSD_NAMESPACE, sizeof(XSD_NAMESPACE), XSD_NS_PREFIX, sizeof(XSD_NS_PREFIX), NULL);
+ zend_hash_add(&soap_globals->defEncNs, SOAP_1_1_ENC_NAMESPACE, sizeof(SOAP_1_1_ENC_NAMESPACE), SOAP_1_1_ENC_NS_PREFIX, sizeof(SOAP_1_1_ENC_NS_PREFIX), NULL);
+ zend_hash_add(&soap_globals->defEncNs, SOAP_1_2_ENC_NAMESPACE, sizeof(SOAP_1_2_ENC_NAMESPACE), SOAP_1_2_ENC_NS_PREFIX, sizeof(SOAP_1_2_ENC_NS_PREFIX), NULL);
soap_globals->use_soap_error_handler = 0;
soap_globals->sdl = NULL;
PHP_MSHUTDOWN_FUNCTION(soap)
{
zend_error_cb = old_error_handler;
+ zend_hash_destroy(&SOAP_GLOBAL(defEnc));
+ zend_hash_destroy(&SOAP_GLOBAL(defEncIndex));
+ zend_hash_destroy(&SOAP_GLOBAL(defEncNs));
zend_hash_destroy(SOAP_GLOBAL(sdls));
- zend_hash_destroy(SOAP_GLOBAL(defEnc));
- zend_hash_destroy(SOAP_GLOBAL(defEncIndex));
- zend_hash_destroy(SOAP_GLOBAL(defEncNs));
- zend_hash_destroy(SOAP_GLOBAL(defEncPrefix));
+ free(SOAP_GLOBAL(sdls));
return SUCCESS;
}
if (Z_TYPE_P(type) == IS_NULL) {
add_property_long(this_ptr, "enc_type", UNKNOWN_TYPE);
} else {
- if (zend_hash_index_exists(SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) {
+ if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) {
add_property_long(this_ptr, "enc_type", Z_LVAL_P(type));
} else {
php_error(E_ERROR, "Invalid type ID to SoapVar constructor");
SOAP_GLOBAL(soap_version) = SOAP_1_2;
}
}
+ xmlFreeDoc(doc_request);
php_error(E_ERROR,"DTD are not supported by SOAP");
}