mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
ext/soap: Use bool as return type instead of int for parse_packet_soap()
This commit is contained in:
parent
a7c7158653
commit
cfc48bd832
2 changed files with 21 additions and 21 deletions
|
@ -19,7 +19,7 @@
|
||||||
#include "php_soap.h"
|
#include "php_soap.h"
|
||||||
|
|
||||||
/* SOAP client calls this function to parse response from SOAP server */
|
/* SOAP client calls this function to parse response from SOAP server */
|
||||||
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers)
|
bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers)
|
||||||
{
|
{
|
||||||
char* envelope_ns = NULL;
|
char* envelope_ns = NULL;
|
||||||
xmlDocPtr response;
|
xmlDocPtr response;
|
||||||
|
@ -33,7 +33,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
|
|
||||||
/* Response for one-way opearation */
|
/* Response for one-way opearation */
|
||||||
if (buffer_size == 0) {
|
if (buffer_size == 0) {
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse XML packet */
|
/* Parse XML packet */
|
||||||
|
@ -41,12 +41,12 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
|
|
||||||
if (!response) {
|
if (!response) {
|
||||||
add_soap_fault(this_ptr, "Client", "looks like we got no XML document", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "looks like we got no XML document", NULL, NULL);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
if (xmlGetIntSubset(response) != NULL) {
|
if (xmlGetIntSubset(response) != NULL) {
|
||||||
add_soap_fault(this_ptr, "Client", "DTD are not supported by SOAP", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "DTD are not supported by SOAP", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get <Envelope> element */
|
/* Get <Envelope> element */
|
||||||
|
@ -65,7 +65,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
} else {
|
} else {
|
||||||
add_soap_fault(this_ptr, "VersionMismatch", "Wrong Version", NULL, NULL);
|
add_soap_fault(this_ptr, "VersionMismatch", "Wrong Version", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trav = trav->next;
|
trav = trav->next;
|
||||||
|
@ -73,7 +73,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
if (env == NULL) {
|
if (env == NULL) {
|
||||||
add_soap_fault(this_ptr, "Client", "looks like we got XML without \"Envelope\" element", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "looks like we got XML without \"Envelope\" element", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
attr = env->properties;
|
attr = env->properties;
|
||||||
|
@ -81,16 +81,16 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
if (attr->ns == NULL) {
|
if (attr->ns == NULL) {
|
||||||
add_soap_fault(this_ptr, "Client", "A SOAP Envelope element cannot have non Namespace qualified attributes", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "A SOAP Envelope element cannot have non Namespace qualified attributes", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
|
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
|
||||||
if (soap_version == SOAP_1_2) {
|
if (soap_version == SOAP_1_2) {
|
||||||
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Envelope", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Envelope", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
|
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
|
||||||
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attr = attr->next;
|
attr = attr->next;
|
||||||
|
@ -122,7 +122,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
if (body == NULL) {
|
if (body == NULL) {
|
||||||
add_soap_fault(this_ptr, "Client", "Body must be present in a SOAP envelope", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "Body must be present in a SOAP envelope", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
attr = body->properties;
|
attr = body->properties;
|
||||||
while (attr != NULL) {
|
while (attr != NULL) {
|
||||||
|
@ -130,17 +130,17 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
if (soap_version == SOAP_1_2) {
|
if (soap_version == SOAP_1_2) {
|
||||||
add_soap_fault(this_ptr, "Client", "A SOAP Body element cannot have non Namespace qualified attributes", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "A SOAP Body element cannot have non Namespace qualified attributes", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
|
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
|
||||||
if (soap_version == SOAP_1_2) {
|
if (soap_version == SOAP_1_2) {
|
||||||
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Body", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Body", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
|
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
|
||||||
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attr = attr->next;
|
attr = attr->next;
|
||||||
|
@ -148,7 +148,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
if (trav != NULL && soap_version == SOAP_1_2) {
|
if (trav != NULL && soap_version == SOAP_1_2) {
|
||||||
add_soap_fault(this_ptr, "Client", "A SOAP 1.2 envelope can contain only Header and Body", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "A SOAP 1.2 envelope can contain only Header and Body", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (head != NULL) {
|
if (head != NULL) {
|
||||||
|
@ -157,16 +157,16 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
if (attr->ns == NULL) {
|
if (attr->ns == NULL) {
|
||||||
add_soap_fault(this_ptr, "Client", "A SOAP Header element cannot have non Namespace qualified attributes", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "A SOAP Header element cannot have non Namespace qualified attributes", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
|
} else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) {
|
||||||
if (soap_version == SOAP_1_2) {
|
if (soap_version == SOAP_1_2) {
|
||||||
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Header", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "encodingStyle cannot be specified on the Header", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
|
} else if (strcmp((char*)attr->children->content, SOAP_1_1_ENC_NAMESPACE) != 0) {
|
||||||
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "Unknown data encoding style", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
attr = attr->next;
|
attr = attr->next;
|
||||||
|
@ -242,7 +242,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
Z_DELREF(details);
|
Z_DELREF(details);
|
||||||
}
|
}
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Parse content of <Body> element */
|
/* Parse content of <Body> element */
|
||||||
|
@ -316,7 +316,7 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
/*
|
/*
|
||||||
add_soap_fault(this_ptr, "Client", "Can't find response data", NULL, NULL);
|
add_soap_fault(this_ptr, "Client", "Can't find response data", NULL, NULL);
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return FALSE;
|
return false;
|
||||||
*/
|
*/
|
||||||
} else {
|
} else {
|
||||||
/* Decoding value of parameter */
|
/* Decoding value of parameter */
|
||||||
|
@ -417,5 +417,5 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
|
||||||
}
|
}
|
||||||
|
|
||||||
xmlFreeDoc(response);
|
xmlFreeDoc(response);
|
||||||
return TRUE;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,6 @@
|
||||||
#ifndef PHP_PACKET_SOAP_H
|
#ifndef PHP_PACKET_SOAP_H
|
||||||
#define PHP_PACKET_SOAP_H
|
#define PHP_PACKET_SOAP_H
|
||||||
|
|
||||||
int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers);
|
bool parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunctionPtr fn, char *fn_name, zval *return_value, zval *soap_headers);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue