TSRM fixes

This commit is contained in:
Marcus Boerger 2004-02-02 21:27:13 +00:00
parent 391494c0ef
commit b1c77fcce3
3 changed files with 15 additions and 13 deletions

View file

@ -2329,13 +2329,14 @@ static xmlNodePtr check_and_resolve_href(xmlNodePtr data)
href = get_attribute_ex(data->properties, "ref", SOAP_1_2_ENC_NAMESPACE); href = get_attribute_ex(data->properties, "ref", SOAP_1_2_ENC_NAMESPACE);
if (href) { if (href) {
char* id; char* id;
xmlNodePtr ret;
if (href->children->content[0] == '#') { if (href->children->content[0] == '#') {
id = href->children->content+1; id = href->children->content+1;
} else { } else {
id = href->children->content; id = href->children->content;
} }
xmlNodePtr ret = get_node_with_attribute_recursive_ex(data->doc->children, NULL, NULL, "id", id, SOAP_1_2_ENC_NAMESPACE); ret = get_node_with_attribute_recursive_ex(data->doc->children, NULL, NULL, "id", id, SOAP_1_2_ENC_NAMESPACE);
if (!ret) { if (!ret) {
php_error(E_ERROR,"SOAP-ERROR: Encoding: Unresolved reference '%s'",href->children->content); php_error(E_ERROR,"SOAP-ERROR: Encoding: Unresolved reference '%s'",href->children->content);
} else if (ret == data) { } else if (ret == data) {

View file

@ -59,6 +59,8 @@ static int stream_alive(php_stream *stream TSRMLS_DC)
static void proxy_authentication(zval* this_ptr, smart_str* soap_headers) static void proxy_authentication(zval* this_ptr, smart_str* soap_headers)
{ {
zval **login, **password; zval **login, **password;
TSRMLS_FETCH();
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login"), (void **)&login) == SUCCESS) { if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login"), (void **)&login) == SUCCESS) {
char* buf; char* buf;
int len; int len;

View file

@ -45,7 +45,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level);
static void clear_soap_fault(zval *obj TSRMLS_DC); static void clear_soap_fault(zval *obj TSRMLS_DC);
static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC); static void set_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC);
static void soap_server_fault(char* code, char* string, char *actor, zval* details); static void soap_server_fault(char* code, char* string, char *actor, zval* details TSRMLS_DC);
static sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int); static sdlParamPtr get_param(sdlFunctionPtr function, char *param_name, int index, int);
static sdlFunctionPtr get_function(sdlPtr sdl, const char *function_name); static sdlFunctionPtr get_function(sdlPtr sdl, const char *function_name);
@ -1150,7 +1150,7 @@ PHP_METHOD(soapserver, handle)
header = header->next; header = header->next;
if (service->sdl && !h->function && h->mustUnderstand) { if (service->sdl && !h->function && h->mustUnderstand) {
soap_server_fault("MustUnderstand","Header not understood", NULL, NULL); soap_server_fault("MustUnderstand","Header not understood", NULL, NULL TSRMLS_CC);
} }
fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name)); fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));
@ -1164,7 +1164,7 @@ PHP_METHOD(soapserver, handle)
php_error(E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name)); php_error(E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name));
} }
} else if (h->mustUnderstand) { } else if (h->mustUnderstand) {
soap_server_fault("MustUnderstand","Header not understood", NULL, NULL); soap_server_fault("MustUnderstand","Header not understood", NULL, NULL TSRMLS_CC);
} }
efree(fn_name); efree(fn_name);
} }
@ -1266,14 +1266,13 @@ PHP_METHOD(soapserver, handle)
SOAP_SERVER_END_CODE(); SOAP_SERVER_END_CODE();
} }
static void soap_server_fault(char* code, char* string, char *actor, zval* details) static void soap_server_fault(char* code, char* string, char *actor, zval* details TSRMLS_DC)
{ {
int soap_version; int soap_version;
xmlChar *buf, cont_len[30]; xmlChar *buf, cont_len[30];
int size; int size;
zval ret; zval ret;
xmlDocPtr doc_return; xmlDocPtr doc_return;
TSRMLS_FETCH();
soap_version = SOAP_GLOBAL(soap_version); soap_version = SOAP_GLOBAL(soap_version);
@ -1956,7 +1955,7 @@ static sdlFunctionPtr deseralize_function_call(sdlPtr sdl, xmlDocPtr request, ch
envelope_ns = SOAP_1_2_ENV_NAMESPACE; envelope_ns = SOAP_1_2_ENV_NAMESPACE;
SOAP_GLOBAL(soap_version) = SOAP_1_2; SOAP_GLOBAL(soap_version) = SOAP_1_2;
} else { } else {
soap_server_fault("VersionMismatch","Wrong Version", NULL, NULL); soap_server_fault("VersionMismatch","Wrong Version", NULL, NULL TSRMLS_CC);
} }
} }
trav = trav->next; trav = trav->next;
@ -2048,18 +2047,18 @@ static sdlFunctionPtr deseralize_function_call(sdlPtr sdl, xmlDocPtr request, ch
if (*version == SOAP_1_1) { if (*version == SOAP_1_1) {
attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_1_ENV_NAMESPACE); attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_1_ENV_NAMESPACE);
if (attr && strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) { if (attr && strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
soap_server_fault("Client","Unknown Data Encoding Style", NULL, NULL); soap_server_fault("Client","Unknown Data Encoding Style", NULL, NULL TSRMLS_CC);
} }
} else { } else {
attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE); attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE);
if (attr && strcmp(attr->children->content,SOAP_1_2_ENC_NAMESPACE) != 0) { if (attr && strcmp(attr->children->content,SOAP_1_2_ENC_NAMESPACE) != 0) {
soap_server_fault("DataEncodingUnknown","Unknown Data Encoding Style", NULL, NULL); soap_server_fault("DataEncodingUnknown","Unknown Data Encoding Style", NULL, NULL TSRMLS_CC);
} }
} }
function = find_function(sdl, func, function_name); function = find_function(sdl, func, function_name);
if (sdl != NULL && function == NULL) { if (sdl != NULL && function == NULL) {
if (*version == SOAP_1_2) { if (*version == SOAP_1_2) {
soap_server_fault("rpc:ProcedureNotPresent","Procedure not present", NULL, NULL); soap_server_fault("rpc:ProcedureNotPresent","Procedure not present", NULL, NULL TSRMLS_CC);
} else { } else {
php_error(E_ERROR, "Procedure '%s' not present", func->name); php_error(E_ERROR, "Procedure '%s' not present", func->name);
} }
@ -2093,7 +2092,7 @@ static sdlFunctionPtr deseralize_function_call(sdlPtr sdl, xmlDocPtr request, ch
if (*version == SOAP_1_1) { if (*version == SOAP_1_1) {
attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_1_ENV_NAMESPACE); attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_1_ENV_NAMESPACE);
if (attr && strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) { if (attr && strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) {
soap_server_fault("Client","Unknown Data Encoding Style", NULL, NULL); soap_server_fault("Client","Unknown Data Encoding Style", NULL, NULL TSRMLS_CC);
} }
attr = get_attribute_ex(func->properties,"actor",envelope_ns); attr = get_attribute_ex(func->properties,"actor",envelope_ns);
if (attr != NULL) { if (attr != NULL) {
@ -2105,7 +2104,7 @@ static sdlFunctionPtr deseralize_function_call(sdlPtr sdl, xmlDocPtr request, ch
} else if (*version == SOAP_1_2) { } else if (*version == SOAP_1_2) {
attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE); attr = get_attribute_ex(func->properties,"encodingStyle",SOAP_1_2_ENV_NAMESPACE);
if (attr && strcmp(attr->children->content,SOAP_1_2_ENC_NAMESPACE) != 0) { if (attr && strcmp(attr->children->content,SOAP_1_2_ENC_NAMESPACE) != 0) {
soap_server_fault("DataEncodingUnknown","Unknown Data Encoding Style", NULL, NULL); soap_server_fault("DataEncodingUnknown","Unknown Data Encoding Style", NULL, NULL TSRMLS_CC);
} }
attr = get_attribute_ex(func->properties,"role",envelope_ns); attr = get_attribute_ex(func->properties,"role",envelope_ns);
if (attr != NULL) { if (attr != NULL) {
@ -2125,7 +2124,7 @@ static sdlFunctionPtr deseralize_function_call(sdlPtr sdl, xmlDocPtr request, ch
strcmp(attr->children->content,"false") == 0) { strcmp(attr->children->content,"false") == 0) {
mustUnderstand = 0; mustUnderstand = 0;
} else { } else {
soap_server_fault("Client","mustUnderstand value is not boolean", NULL, NULL); soap_server_fault("Client","mustUnderstand value is not boolean", NULL, NULL TSRMLS_CC);
} }
} }
h = emalloc(sizeof(soapHeader)); h = emalloc(sizeof(soapHeader));