Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 19 additions & 26 deletions ext/soap/php_schema.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,22 @@ static void schema_load_file(sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, xmlA
}
}

/* Returned uri must be freed by the caller. */
xmlChar *schema_location_construct_uri(const xmlAttr *attribute)
{
xmlChar *uri;
xmlChar *base = xmlNodeGetBase(attribute->doc, attribute->parent);

if (base == NULL) {
uri = xmlBuildURI(attribute->children->content, attribute->doc->URL);
} else {
uri = xmlBuildURI(attribute->children->content, base);
xmlFree(base);
}

return uri;
}

/*
2.6.1 xsi:type
2.6.2 xsi:nil
Expand Down Expand Up @@ -196,15 +212,7 @@ int load_schema(sdlCtx *ctx, xmlNodePtr schema)
if (location == NULL) {
soap_error0(E_ERROR, "Parsing Schema: include has no 'schemaLocation' attribute");
} else {
xmlChar *uri;
xmlChar *base = xmlNodeGetBase(trav->doc, trav);

if (base == NULL) {
uri = xmlBuildURI(location->children->content, trav->doc->URL);
} else {
uri = xmlBuildURI(location->children->content, base);
xmlFree(base);
}
xmlChar *uri = schema_location_construct_uri(location);
schema_load_file(ctx, NULL, uri, tns, 0);
xmlFree(uri);
}
Expand All @@ -216,15 +224,7 @@ int load_schema(sdlCtx *ctx, xmlNodePtr schema)
if (location == NULL) {
soap_error0(E_ERROR, "Parsing Schema: redefine has no 'schemaLocation' attribute");
} else {
xmlChar *uri;
xmlChar *base = xmlNodeGetBase(trav->doc, trav);

if (base == NULL) {
uri = xmlBuildURI(location->children->content, trav->doc->URL);
} else {
uri = xmlBuildURI(location->children->content, base);
xmlFree(base);
}
xmlChar *uri = schema_location_construct_uri(location);
schema_load_file(ctx, NULL, uri, tns, 0);
xmlFree(uri);
/* TODO: <redefine> support */
Expand All @@ -245,14 +245,7 @@ int load_schema(sdlCtx *ctx, xmlNodePtr schema)
}
}
if (location) {
xmlChar *base = xmlNodeGetBase(trav->doc, trav);

if (base == NULL) {
uri = xmlBuildURI(location->children->content, trav->doc->URL);
} else {
uri = xmlBuildURI(location->children->content, base);
xmlFree(base);
}
uri = schema_location_construct_uri(location);
}
schema_load_file(ctx, ns, uri, tns, 1);
if (uri != NULL) {xmlFree(uri);}
Expand Down
2 changes: 2 additions & 0 deletions ext/soap/php_schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
int load_schema(sdlCtx *ctx, xmlNodePtr schema);
void schema_pass2(sdlCtx *ctx);

xmlChar *schema_location_construct_uri(const xmlAttr *attribute);

void delete_model(zval *zv);
void delete_model_persistent(zval *zv);
void delete_type(zval *zv);
Expand Down
10 changes: 1 addition & 9 deletions ext/soap/php_sdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -361,15 +361,7 @@ static void load_wsdl_ex(zval *this_ptr, char *struri, sdlCtx *ctx, int include)
/* TODO: namespace ??? */
xmlAttrPtr tmp = get_attribute(trav->properties, "location");
if (tmp) {
xmlChar *uri;
xmlChar *base = xmlNodeGetBase(trav->doc, trav);

if (base == NULL) {
uri = xmlBuildURI(tmp->children->content, trav->doc->URL);
} else {
uri = xmlBuildURI(tmp->children->content, base);
xmlFree(base);
}
xmlChar *uri = schema_location_construct_uri(tmp);
load_wsdl_ex(this_ptr, (char*)uri, ctx, 1);
xmlFree(uri);
}
Expand Down
Loading