mirror of
https://github.com/php/php-src.git
synced 2025-01-18 09:43:36 +08:00
Migrated to C style comments.
This commit is contained in:
parent
74e34d1657
commit
05ff5da32b
@ -40,7 +40,7 @@ encode defaultEncoding[] = {
|
||||
{{SOAP_ENC_OBJECT, SOAP_ENC_OBJECT_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_object, to_xml_object},
|
||||
{{SOAP_ENC_ARRAY, SOAP_ENC_ARRAY_STRING, SOAP_ENC_NAMESPACE, NULL}, to_zval_array, to_xml_array},
|
||||
|
||||
//support some of the 1999 data types
|
||||
/* support some of the 1999 data types */
|
||||
{{XSD_STRING, XSD_STRING_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_string, to_xml_string},
|
||||
{{XSD_BOOLEAN, XSD_BOOLEAN_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_bool, to_xml_bool},
|
||||
{{XSD_DECIMAL, XSD_DECIMAL_STRING, XSD_1999_NAMESPACE, NULL}, to_zval_long, to_xml_string},
|
||||
@ -53,7 +53,7 @@ encode defaultEncoding[] = {
|
||||
|
||||
{{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
|
||||
|
||||
//TODO: finish off encoding
|
||||
/* TODO: finish off encoding */
|
||||
/*
|
||||
#define XSD_DURATION 107
|
||||
#define XSD_DURATION_STRING "duration"
|
||||
@ -259,8 +259,8 @@ zval *to_zval_after_user(encodeType type, zval *data)
|
||||
}
|
||||
#endif
|
||||
|
||||
//TODO: get rid of "bogus".. ither by passing in the already created xmlnode or passing in the node name
|
||||
//String encode/decode
|
||||
/* TODO: get rid of "bogus".. ither by passing in the already created xmlnode or passing in the node name */
|
||||
/* String encode/decode */
|
||||
zval *to_zval_string(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
@ -389,7 +389,7 @@ xmlNodePtr to_xml_bool(encodeType type, zval *data, int style)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//Null encode/decode
|
||||
/* Null encode/decode */
|
||||
zval *to_zval_null(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
@ -410,7 +410,7 @@ xmlNodePtr to_xml_null(encodeType type, zval *data, int style)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//Struct encode/decode
|
||||
/* Struct encode/decode */
|
||||
zval *to_zval_object(encodeType type, xmlNodePtr data)
|
||||
{
|
||||
zval *ret;
|
||||
@ -447,7 +447,7 @@ xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
||||
int i;
|
||||
TSRMLS_FETCH();
|
||||
|
||||
//Special handling of class SoapVar
|
||||
/* Special handling of class SoapVar */
|
||||
if(data && Z_TYPE_P(data) == IS_OBJECT && !strcmp(Z_OBJCE_P(data)->name, soap_var_class_entry.name))
|
||||
{
|
||||
zval **ztype, **zdata, **zns, **zstype, **zname, **znamens;
|
||||
@ -519,7 +519,7 @@ xmlNodePtr to_xml_object(encodeType type, zval *data, int style)
|
||||
return xmlParam;
|
||||
}
|
||||
|
||||
//Array encode/decode
|
||||
/* Array encode/decode */
|
||||
xmlNodePtr guess_array_map(encodeType type, zval *data, int style)
|
||||
{
|
||||
encodePtr enc = NULL;
|
||||
@ -624,7 +624,7 @@ zval *to_zval_array(encodeType type, xmlNodePtr data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//Map encode/decode
|
||||
/* Map encode/decode */
|
||||
xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
|
||||
{
|
||||
xmlNodePtr xmlParam;
|
||||
@ -637,7 +637,7 @@ xmlNodePtr to_xml_map(encodeType type, zval *data, int style)
|
||||
if(Z_TYPE_P(data) == IS_ARRAY)
|
||||
{
|
||||
i = zend_hash_num_elements(Z_ARRVAL_P(data));
|
||||
//TODO: Register namespace...???
|
||||
/* TODO: Register namespace...??? */
|
||||
xmlSetProp(xmlParam, "xmlns:apache", "http://xml.apache.org/xml-soap");
|
||||
zend_hash_internal_pointer_reset(data->value.ht);
|
||||
for(;i > 0;i--)
|
||||
@ -731,7 +731,7 @@ zval *to_zval_map(encodeType type, xmlNodePtr data)
|
||||
return ret;
|
||||
}
|
||||
|
||||
//Unknown encode/decode
|
||||
/* Unknown encode/decode */
|
||||
xmlNodePtr guess_xml_convert(encodeType type, zval *data, int style)
|
||||
{
|
||||
encodePtr enc;
|
||||
@ -760,14 +760,16 @@ zval *guess_zval_convert(encodeType type, xmlNodePtr data)
|
||||
if(tmpattr != NULL)
|
||||
{
|
||||
enc = get_conversion_from_type(data, tmpattr->children->content);
|
||||
// if(enc == NULL)
|
||||
// php_error(E_ERROR, "Error (Don't know how to encode/decode \"%s\")", tmpattr->children->content);
|
||||
/*
|
||||
if(enc == NULL)
|
||||
php_error(E_ERROR, "Error (Don't know how to encode/decode \"%s\")", tmpattr->children->content);
|
||||
*/
|
||||
}
|
||||
|
||||
if(enc == NULL)
|
||||
{
|
||||
//Didn't have a type, totally guess here
|
||||
//Logic: has children = IS_OBJECT else IS_STRING
|
||||
/* Didn't have a type, totally guess here */
|
||||
/* Logic: has children = IS_OBJECT else IS_STRING */
|
||||
xmlNodePtr trav;
|
||||
|
||||
if(get_attribute(data->properties, "arrayType"))
|
||||
@ -791,10 +793,10 @@ zval *guess_zval_convert(encodeType type, xmlNodePtr data)
|
||||
return master_to_zval(enc, data);
|
||||
}
|
||||
|
||||
//Time encode/decode
|
||||
/* Time encode/decode */
|
||||
xmlNodePtr to_xml_datetime_ex(encodeType type, zval *data, char *format, int style)
|
||||
{
|
||||
//logic hacked from ext/standard/datetime.c
|
||||
/* logic hacked from ext/standard/datetime.c */
|
||||
struct tm *ta, tmbuf;
|
||||
time_t timestamp;
|
||||
int max_reallocs = 5;
|
||||
|
@ -62,7 +62,9 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
}
|
||||
else
|
||||
php_error(E_ERROR,"Could not connect to host");
|
||||
//php_url_free(phpurl);
|
||||
/*
|
||||
php_url_free(phpurl);
|
||||
*/
|
||||
}
|
||||
|
||||
if(stream)
|
||||
@ -71,10 +73,10 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
char *header = "POST %s HTTP/1.1\r\nConnection: close\r\nAccept: text/html; text/xml; text/plain\r\nUser-Agent: PHP SOAP 0.1\r\nHost: %s\r\nContent-Type: text/xml\r\nContent-Length: %d\r\nSOAPAction: \"%s\"\r\n";
|
||||
int size = strlen(header) + strlen(phpurl->host) + strlen(phpurl->path) + 10;
|
||||
|
||||
// TODO: Add authication
|
||||
/* TODO: Add authentication */
|
||||
if(sdl != NULL)
|
||||
{
|
||||
// TODO: need to grab soap action from wsdl....
|
||||
/* TODO: need to grab soap action from wsdl....*/
|
||||
soap_headers = emalloc(size + strlen(soapaction));
|
||||
sprintf(soap_headers, header, phpurl->path, phpurl->host, buf_size, soapaction);
|
||||
}
|
||||
@ -92,7 +94,7 @@ void send_http_soap_request(zval *this_ptr, xmlDoc *doc, char *function_name, ch
|
||||
if(err != (int)strlen(soap_headers))
|
||||
php_error(E_ERROR,"Failed Sending HTTP Headers");
|
||||
|
||||
// Send cookies along with request
|
||||
/* Send cookies along with request */
|
||||
if(zend_hash_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies"), (void **)&cookies) == SUCCESS)
|
||||
{
|
||||
smart_str cookie_str = {0};
|
||||
@ -170,7 +172,7 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
if(!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC))
|
||||
php_error(E_ERROR, "Error Fetching http headers");
|
||||
|
||||
//Check to see what HTTP status was sent
|
||||
/* Check to see what HTTP status was sent */
|
||||
http_version = get_http_header_value(http_headers,"HTTP/");
|
||||
if(http_version)
|
||||
{
|
||||
@ -205,7 +207,7 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
return;
|
||||
}*/
|
||||
|
||||
//Try and get headers again
|
||||
/* Try and get headers again */
|
||||
if(!strcmp(http_status, "100"))
|
||||
{
|
||||
if(!get_http_headers(stream, &http_headers, &http_header_size TSRMLS_CC))
|
||||
@ -222,9 +224,10 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
&& Z_LVAL_PP(trace) > 0)
|
||||
add_property_stringl(this_ptr, "__last_response", http_body, http_body_size, 1);
|
||||
|
||||
// Close every time right now till i can spend more time on it
|
||||
// it works.. it's just slower??
|
||||
//See if the server requested a close
|
||||
/* Close every time right now till i can spend more time on it
|
||||
it works.. it's just slower??
|
||||
*/
|
||||
/* See if the server requested a close */
|
||||
http_close = TRUE;
|
||||
/*
|
||||
connection = get_http_header_value(http_headers,"Connection: ");
|
||||
@ -252,7 +255,7 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", strlen("httpsocket") + 1);
|
||||
}
|
||||
|
||||
//Check and see if the server even sent a xml document
|
||||
/* Check and see if the server even sent a xml document */
|
||||
content_type = get_http_header_value(http_headers,"Content-Type: ");
|
||||
if(content_type)
|
||||
{
|
||||
@ -279,10 +282,12 @@ void get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRML
|
||||
efree(content_type);
|
||||
}
|
||||
|
||||
//Grab and send back every cookie
|
||||
//Not going to worry about Path: because
|
||||
//we shouldn't be changing urls so path dont
|
||||
//matter too much
|
||||
/* Grab and send back every cookie */
|
||||
|
||||
/* Not going to worry about Path: because
|
||||
we shouldn't be changing urls so path dont
|
||||
matter too much
|
||||
*/
|
||||
cookie_itt = strstr(http_headers,"Set-Cookie: ");
|
||||
while(cookie_itt)
|
||||
{
|
||||
@ -355,8 +360,9 @@ int get_http_body(SOAP_STREAM stream, char *headers, char **response, int *out_
|
||||
trans_enc = get_http_header_value(headers, "Transfer-Encoding: ");
|
||||
content_length = get_http_header_value(headers, "Content-Length: ");
|
||||
|
||||
//this is temp...
|
||||
// netscape enterprise server sends in lowercase???
|
||||
/* this is temp...
|
||||
netscape enterprise server sends in lowercase???
|
||||
*/
|
||||
if(content_length == NULL)
|
||||
content_length = get_http_header_value(headers, "Content-length: ");
|
||||
|
||||
@ -393,7 +399,7 @@ int get_http_body(SOAP_STREAM stream, char *headers, char **response, int *out_
|
||||
#ifdef PHP_STREAMS
|
||||
php_stream_getc(stream);php_stream_getc(stream);
|
||||
#else
|
||||
//Eat up '\r' '\n'
|
||||
/* Eat up '\r' '\n' */
|
||||
php_sock_fgetc(stream);php_sock_fgetc(stream);
|
||||
#endif
|
||||
}
|
||||
|
@ -186,7 +186,7 @@ int schema_simpleContent(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr simpCompType, s
|
||||
content = get_node(simpCompType->children, "extension");
|
||||
if(content == NULL)
|
||||
{
|
||||
//schema_extension(sdl, tsn, content, cur_type);
|
||||
/* schema_extension(sdl, tsn, content, cur_type); */
|
||||
php_error(E_ERROR, "Error parsing schema (doesn't support extensions on simpleContent)");
|
||||
return TRUE;
|
||||
}
|
||||
@ -218,7 +218,9 @@ int schema_restriction_simpleType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr restTy
|
||||
base = get_attribute(restType->properties, "base");
|
||||
if(base != NULL)
|
||||
{
|
||||
//cur_type->base = estrdup(base->children->content);
|
||||
/*
|
||||
cur_type->base = estrdup(base->children->content);
|
||||
*/
|
||||
}
|
||||
|
||||
if(cur_type->restrictions == NULL)
|
||||
@ -611,7 +613,9 @@ int schema_choice(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr choiceType, sdlTypePtr
|
||||
{
|
||||
xmlNodePtr trav, data;
|
||||
|
||||
//cur_type->property_type = CHOICE;
|
||||
/*
|
||||
cur_type->property_type = CHOICE;
|
||||
*/
|
||||
|
||||
trav = choiceType->children;
|
||||
FOREACHNODE(trav, "element", data)
|
||||
@ -796,7 +800,7 @@ int schema_complexType(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr compType, sdlType
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
//(group | all | choice | sequence)
|
||||
/* (group | all | choice | sequence) */
|
||||
content = get_node(compType->children, "group");
|
||||
if(content != NULL)
|
||||
{
|
||||
@ -911,7 +915,7 @@ int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr c
|
||||
if(curattr)
|
||||
cur_type->min_occurs = atoi(curattr->children->content);
|
||||
|
||||
//nillable = boolean : false
|
||||
/* nillable = boolean : false */
|
||||
attrs = element->properties;
|
||||
curattr = get_attribute(attrs, "nillable");
|
||||
if(curattr)
|
||||
@ -925,7 +929,7 @@ int schema_element(sdlPtr *sdl, xmlAttrPtr tsn, xmlNodePtr element, sdlTypePtr c
|
||||
else
|
||||
cur_type->nullable = FALSE;
|
||||
|
||||
//type = QName
|
||||
/* type = QName */
|
||||
curattr = get_attribute(attrs, "type");
|
||||
if(!curattr)
|
||||
curattr = name;
|
||||
|
@ -152,7 +152,9 @@ xmlNodePtr sdl_guess_convert_xml(encodeType enc, zval *data, int style)
|
||||
else
|
||||
ret = guess_xml_convert(enc, data, style);
|
||||
|
||||
//set_ns_and_type(ret, enc);
|
||||
/*
|
||||
set_ns_and_type(ret, enc);
|
||||
*/
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -287,7 +289,7 @@ zval *sdl_convert_zval(xmlNodePtr data, sdlTypePtr type)
|
||||
service->soap_class.ce = ce;
|
||||
}
|
||||
}
|
||||
//this function will take a zval and apply all attributes of sldTypePtr
|
||||
// this function will take a zval and apply all attributes of sldTypePtr
|
||||
zval *sdl_convert_zval_to_zval(zval *data, sdlTypePtr type)
|
||||
{
|
||||
}
|
||||
@ -342,7 +344,8 @@ sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns)
|
||||
|
||||
int load_php_sdl()
|
||||
{
|
||||
/* xmlNodePtr rootElement;
|
||||
#ifdef BRAD_0
|
||||
xmlNodePtr rootElement;
|
||||
xmlNodePtr services;
|
||||
|
||||
SOAP_SERVER_GLOBAL_VARS();
|
||||
@ -360,7 +363,7 @@ int load_php_sdl()
|
||||
HashTable *include = NULL;
|
||||
HashTable *cl = NULL;
|
||||
|
||||
//Init New Service
|
||||
/* Init New Service */
|
||||
newService = emalloc(sizeof(phpSoapService));
|
||||
newService->serviceNode = services;
|
||||
newService->started = FALSE;
|
||||
@ -372,14 +375,14 @@ int load_php_sdl()
|
||||
|
||||
attrib = services->properties;
|
||||
trav = attrib;
|
||||
//Get Attributes of Service
|
||||
/* Get Attributes of Service */
|
||||
do
|
||||
{
|
||||
if(IS_ATTRIBUTE_TYPE(trav,PHP_SOAPSERVER_SERVICE_NAME))
|
||||
{
|
||||
char* name = ATTRIBUTE_VALUE(trav);
|
||||
|
||||
//Assign Service Vals
|
||||
/* Assign Service Vals */
|
||||
ALLOC_INIT_ZVAL(newService->serviceName);
|
||||
ZVAL_STRING(newService->serviceName,name,1);
|
||||
}
|
||||
@ -388,18 +391,18 @@ int load_php_sdl()
|
||||
{
|
||||
char* started = ATTRIBUTE_VALUE(trav);
|
||||
|
||||
//Assign Service Vals
|
||||
/* Assign Service Vals */
|
||||
if(!stricmp(started,"true"))
|
||||
newService->started = TRUE;
|
||||
}
|
||||
}
|
||||
while(trav = trav->next);
|
||||
|
||||
//Get ChildNodes of Service
|
||||
/* Get ChildNodes of Service */
|
||||
trav = services->children;
|
||||
do
|
||||
{
|
||||
//Include Files
|
||||
/* Include Files */
|
||||
if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_INCLUDE_FILE))
|
||||
{
|
||||
xmlNodePtr trav1 = trav->properties;
|
||||
@ -417,7 +420,7 @@ int load_php_sdl()
|
||||
while(trav1 = trav1->next);
|
||||
}
|
||||
|
||||
//Functions
|
||||
/* Functions */
|
||||
if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_FUNCTION))
|
||||
{
|
||||
phpSoapServiceFunctionPtr function;
|
||||
@ -485,7 +488,7 @@ int load_php_sdl()
|
||||
zend_hash_add(fn,Z_STRVAL_P(function->functionName),Z_STRLEN_P(function->functionName),function,sizeof(phpSoapServiceFunction),NULL);
|
||||
}
|
||||
|
||||
//Classes
|
||||
/* Classes */
|
||||
if(IS_ELEMENT_TYPE(trav,PHP_SOAPSERVER_SERVICE_CLASS))
|
||||
{
|
||||
xmlNodePtr att, func;
|
||||
@ -505,7 +508,7 @@ int load_php_sdl()
|
||||
}
|
||||
}
|
||||
while(services = services->next);
|
||||
*/
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -598,7 +601,7 @@ sdlPtr load_wsdl(char *struri, sdlPtr parent)
|
||||
if(bindingAttr == NULL)
|
||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding associated with port");
|
||||
|
||||
//find address and figure out binding type
|
||||
/* find address and figure out binding type */
|
||||
address = get_node(port->children, "address");
|
||||
if(!address)
|
||||
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No address associated with port");
|
||||
@ -928,7 +931,8 @@ int write_ms_sdl()
|
||||
|
||||
int load_ms_sdl(char *struri,int force_load)
|
||||
{
|
||||
/* Commenting this out. Does anyone need it?
|
||||
/* Commenting this out. Does anyone need it? */
|
||||
#ifdef BRAD_0
|
||||
|
||||
if(get_sdl(struri) == NULL || force_load)
|
||||
{
|
||||
@ -981,7 +985,7 @@ int load_ms_sdl(char *struri,int force_load)
|
||||
ALLOC_INIT_ZVAL(tmpFunction->soapAction);
|
||||
ZVAL_STRING(tmpFunction->soapAction,soapAction,1);
|
||||
|
||||
//Request
|
||||
/* Request */
|
||||
req = get_node(reqRes->children,"request");
|
||||
tmpattr = get_attribute(req->properties,"ref");
|
||||
if(tmpattr != NULL)
|
||||
@ -996,7 +1000,7 @@ int load_ms_sdl(char *struri,int force_load)
|
||||
efree(namespace);
|
||||
}
|
||||
|
||||
//Response
|
||||
/* Response */
|
||||
res = get_node(reqRes->children,"response");
|
||||
tmpattr = get_attribute(res->properties,"ref");
|
||||
if(tmpattr != NULL)
|
||||
@ -1011,7 +1015,7 @@ int load_ms_sdl(char *struri,int force_load)
|
||||
efree(namespace);
|
||||
}
|
||||
|
||||
//Parameters
|
||||
/* Parameters */
|
||||
paramOrd = get_node(reqRes->children,"parameterorder");
|
||||
if(paramOrd != NULL)
|
||||
{
|
||||
@ -1024,7 +1028,7 @@ int load_ms_sdl(char *struri,int force_load)
|
||||
ALLOC_INIT_ZVAL(array);
|
||||
array_init(array);
|
||||
|
||||
//Split on space
|
||||
/* Split on space */
|
||||
php_explode(space, tempZval, array, -1);
|
||||
zend_hash_internal_pointer_reset(array->value.ht);
|
||||
count = zend_hash_num_elements(array->value.ht);
|
||||
@ -1057,7 +1061,8 @@ int load_ms_sdl(char *struri,int force_load)
|
||||
sdlPtr->have_sdl = 1;
|
||||
map_types_to_functions(sdlPtr);
|
||||
zend_hash_add(SOAP_GLOBAL(SDLs),struri,strlen(struri),sdlPtr,sizeof(SDL),NULL);
|
||||
}*/
|
||||
}
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -183,12 +183,12 @@ xmlNodePtr check_and_resolve_href(xmlNodePtr data)
|
||||
href = get_attribute(data->properties, "href");
|
||||
if(href)
|
||||
{
|
||||
// Internal href try and find node
|
||||
/* Internal href try and find node */
|
||||
if(href->children->content[0] == '#')
|
||||
{
|
||||
ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]);
|
||||
}
|
||||
// External href....?
|
||||
/* External href....? */
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
113
ext/soap/soap.c
113
ext/soap/soap.c
@ -5,7 +5,7 @@ int le_http_socket = 0;
|
||||
int le_url = 0;
|
||||
int le_service = 0;
|
||||
|
||||
// Local functions
|
||||
/* Local functions */
|
||||
static void function_to_string(sdlFunctionPtr function, smart_str *buf);
|
||||
static void type_to_string(sdlTypePtr type, smart_str *buf, int level);
|
||||
|
||||
@ -126,7 +126,7 @@ static void php_soap_init_globals(zend_soap_globals *soap_globals)
|
||||
{
|
||||
enc = (long)&defaultEncoding[i];
|
||||
|
||||
//If has a ns and a str_type then index it
|
||||
/* If has a ns and a str_type then index it */
|
||||
if(defaultEncoding[i].details.type_str)
|
||||
{
|
||||
if(defaultEncoding[i].details.ns != NULL)
|
||||
@ -142,18 +142,18 @@ static void php_soap_init_globals(zend_soap_globals *soap_globals)
|
||||
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
|
||||
/* Index everything by number */
|
||||
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
|
||||
/* 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, APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), NULL);
|
||||
zend_hash_add(soap_globals->defEncNs, SOAP_ENC_NAMESPACE, sizeof(SOAP_ENC_NAMESPACE), SOAP_ENC_NS_PREFIX, sizeof(SOAP_ENC_NS_PREFIX), NULL);
|
||||
//and by prefix
|
||||
/* 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, APACHE_NS_PREFIX, sizeof(APACHE_NS_PREFIX), APACHE_NAMESPACE, sizeof(APACHE_NAMESPACE), NULL);
|
||||
zend_hash_add(soap_globals->defEncPrefix, SOAP_ENC_NS_PREFIX, sizeof(SOAP_ENC_NS_PREFIX), SOAP_ENC_NAMESPACE, sizeof(SOAP_ENC_NAMESPACE), NULL);
|
||||
@ -182,26 +182,26 @@ PHP_MSHUTDOWN_FUNCTION(soap)
|
||||
|
||||
PHP_MINIT_FUNCTION(soap)
|
||||
{
|
||||
//TODO: add ini entry for always use soap errors
|
||||
/* TODO: add ini entry for always use soap errors */
|
||||
ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, php_soap_del_globals);
|
||||
|
||||
//Register SoapObject class
|
||||
/* Register SoapObject class */
|
||||
INIT_OVERLOADED_CLASS_ENTRY(soap_class_entry, PHP_SOAP_CLASSNAME, soap_client_functions, soap_call_function_handler, NULL, NULL);
|
||||
zend_register_internal_class(&soap_class_entry TSRMLS_CC);
|
||||
|
||||
//Register SoapVar class
|
||||
/* Register SoapVar class */
|
||||
INIT_CLASS_ENTRY(soap_var_class_entry, PHP_SOAP_VAR_CLASSNAME, soap_var_functions);
|
||||
zend_register_internal_class(&soap_var_class_entry TSRMLS_CC);
|
||||
|
||||
//Register SoapServer class
|
||||
/* Register SoapServer class */
|
||||
INIT_CLASS_ENTRY(soap_server_class_entry, PHP_SOAP_SERVER_CLASSNAME, soap_server_functions);
|
||||
zend_register_internal_class(&soap_server_class_entry TSRMLS_CC);
|
||||
|
||||
//Register SoapFault class
|
||||
/* Register SoapFault class */
|
||||
INIT_CLASS_ENTRY(soap_fault_class_entry, PHP_SOAP_FAULT_CLASSNAME, soap_fault_functions);
|
||||
zend_register_internal_class(&soap_fault_class_entry TSRMLS_CC);
|
||||
|
||||
//Register SoapParam class
|
||||
/* Register SoapParam class */
|
||||
INIT_CLASS_ENTRY(soap_param_class_entry, PHP_SOAP_PARAM_CLASSNAME, soap_param_functions);
|
||||
zend_register_internal_class(&soap_param_class_entry TSRMLS_CC);
|
||||
|
||||
@ -402,7 +402,7 @@ PHP_FUNCTION(soap_encode_to_zval)
|
||||
}
|
||||
#endif
|
||||
|
||||
//SoapParam functions
|
||||
/* SoapParam functions */
|
||||
PHP_FUNCTION(soapparam)
|
||||
{
|
||||
zval *thisObj, *data;
|
||||
@ -419,7 +419,7 @@ PHP_FUNCTION(soapparam)
|
||||
add_property_zval(thisObj, "param_data", data);
|
||||
}
|
||||
|
||||
//SoapFault functions
|
||||
/* SoapFault functions */
|
||||
PHP_FUNCTION(soapfault)
|
||||
{
|
||||
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL;
|
||||
@ -437,7 +437,7 @@ PHP_FUNCTION(soapfault)
|
||||
set_soap_fault(thisObj, fault_code, fault_string, fault_actor, details TSRMLS_CC);
|
||||
}
|
||||
|
||||
//SoapVar functions
|
||||
/* SoapVar functions */
|
||||
PHP_FUNCTION(soapvar)
|
||||
{
|
||||
zval *data, *thisObj, *type;
|
||||
@ -471,7 +471,7 @@ PHP_FUNCTION(soapvar)
|
||||
add_property_stringl(thisObj, "enc_namens", namens, namens_len, 1);
|
||||
}
|
||||
|
||||
//SoapServer functions
|
||||
/* SoapServer functions */
|
||||
PHP_FUNCTION(soapserver)
|
||||
{
|
||||
zval *thisObj;
|
||||
@ -899,12 +899,13 @@ PHP_FUNCTION(handle)
|
||||
}
|
||||
}
|
||||
|
||||
//Turn on output buffering... we don't want people print in their methods
|
||||
//#if PHP_API_VERSION <= 20010901
|
||||
// if(php_start_ob_buffer(NULL, 0 TSRMLS_CC) != SUCCESS)
|
||||
//#else
|
||||
/* Turn on output buffering... we don't want people print in their methods
|
||||
#if PHP_API_VERSION <= 20010901
|
||||
if(php_start_ob_buffer(NULL, 0 TSRMLS_CC) != SUCCESS)
|
||||
#else
|
||||
*/
|
||||
if(php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC) != SUCCESS)
|
||||
//#endif
|
||||
/* #endif */
|
||||
php_error(E_ERROR,"ob_start failed");
|
||||
|
||||
if (zend_hash_find(&EG(symbol_table), HTTP_RAW_POST_DATA, sizeof(HTTP_RAW_POST_DATA), (void **) &raw_post)!=FAILURE
|
||||
@ -923,16 +924,18 @@ PHP_FUNCTION(handle)
|
||||
if(service->type == SOAP_CLASS)
|
||||
{
|
||||
soap_obj = NULL;
|
||||
//If persistent then set soap_obj from from the previous created session (if available)
|
||||
/* If persistent then set soap_obj from from the previous created session (if available) */
|
||||
if(service->soap_class.persistance == SOAP_PERSISTENCE_SESSION)
|
||||
{
|
||||
zval **tmp_soap;
|
||||
|
||||
//Try and call session regiser for our dummy session object
|
||||
//The only reason that i use call_user_function is that
|
||||
//their isn't a way to start the session from an extension
|
||||
//so calling session_register will both register the var
|
||||
//and start the session
|
||||
/*
|
||||
Try and call session regiser for our dummy session object
|
||||
The only reason that i use call_user_function is that
|
||||
their isn't a way to start the session from an extension
|
||||
so calling session_register will both register the var
|
||||
and start the session
|
||||
*/
|
||||
{
|
||||
zval *bogus_session_name, session_register, sess_retval;
|
||||
|
||||
@ -955,19 +958,19 @@ PHP_FUNCTION(handle)
|
||||
zval_dtor(&sess_retval);
|
||||
}
|
||||
|
||||
//Find the soap object and assign
|
||||
/* Find the soap object and assign */
|
||||
if(zend_hash_find(&EG(symbol_table), "_bogus_session_name", sizeof("_bogus_session_name"), (void **) &tmp_soap) == SUCCESS)
|
||||
soap_obj = *tmp_soap;
|
||||
}
|
||||
|
||||
//If new session or something wierd happned
|
||||
/* If new session or something wierd happned */
|
||||
if(soap_obj == NULL)
|
||||
{
|
||||
zval *tmp_soap;
|
||||
MAKE_STD_ZVAL(tmp_soap);
|
||||
object_init_ex(tmp_soap, service->soap_class.ce);
|
||||
|
||||
//Call constructor
|
||||
/* Call constructor */
|
||||
if(zend_hash_exists(&Z_OBJCE_P(tmp_soap)->function_table, service->soap_class.ce->name, strlen(service->soap_class.ce->name) + 1))
|
||||
{
|
||||
zval c_ret, constructor;
|
||||
@ -982,7 +985,7 @@ PHP_FUNCTION(handle)
|
||||
zval_dtor(&c_ret);
|
||||
}
|
||||
|
||||
//If session then update session hash with new object
|
||||
/* If session then update session hash with new object */
|
||||
if(service->soap_class.persistance == SOAP_PERSISTENCE_SESSION)
|
||||
{
|
||||
zval **tmp_soap_pp;
|
||||
@ -1028,10 +1031,10 @@ PHP_FUNCTION(handle)
|
||||
else
|
||||
php_error(E_ERROR, "Function (%s) call failed", Z_STRVAL(function_name));
|
||||
|
||||
//Flush buffer
|
||||
/* Flush buffer */
|
||||
php_end_ob_buffer(0, 0 TSRMLS_CC);
|
||||
|
||||
//xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8);
|
||||
/* xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8); */
|
||||
xmlDocDumpMemory(doc_return, &buf, &size);
|
||||
|
||||
if(size == 0)
|
||||
@ -1041,7 +1044,7 @@ PHP_FUNCTION(handle)
|
||||
sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
|
||||
sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
|
||||
|
||||
//Free Memory
|
||||
/* Free Memory */
|
||||
if(num_params > 0)
|
||||
{
|
||||
for(i = 0; i < num_params;i++)
|
||||
@ -1081,9 +1084,11 @@ void soap_error_handler(int error_num, const char *error_filename, const uint er
|
||||
buffer_len = sizeof(buffer) - 1;
|
||||
}
|
||||
|
||||
//Trap all errors
|
||||
//What do do with these warnings
|
||||
// E_WARNING, E_NOTICE, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING, E_USER_NOTICE
|
||||
/*
|
||||
Trap all errors
|
||||
What do do with these warnings
|
||||
E_WARNING, E_NOTICE, E_CORE_WARNING, E_COMPILE_WARNING, E_USER_WARNING, E_USER_NOTICE
|
||||
*/
|
||||
if(error_num == E_USER_ERROR || error_num == E_COMPILE_ERROR || error_num == E_CORE_ERROR ||
|
||||
error_num == E_ERROR || error_num == E_PARSE)
|
||||
{
|
||||
@ -1096,7 +1101,7 @@ void soap_error_handler(int error_num, const char *error_filename, const uint er
|
||||
INIT_ZVAL(outbuflen);
|
||||
INIT_ZVAL(ret);
|
||||
|
||||
//Get output buffer and send as fault detials
|
||||
/* Get output buffer and send as fault detials */
|
||||
if(php_ob_get_length(&outbuflen TSRMLS_CC) != FAILURE && Z_LVAL(outbuflen) != 0)
|
||||
php_ob_get_buffer(&outbuf TSRMLS_CC);
|
||||
php_end_ob_buffer(0, 0 TSRMLS_CC);
|
||||
@ -1104,16 +1109,20 @@ void soap_error_handler(int error_num, const char *error_filename, const uint er
|
||||
set_soap_fault(&ret, "SOAP-ENV:Server", buffer, NULL, &outbuf TSRMLS_CC);
|
||||
doc_return = seralize_response_call(NULL, NULL, NULL, &ret);
|
||||
|
||||
//Build and send our headers + http 500 status
|
||||
//xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8);
|
||||
/* Build and send our headers + http 500 status */
|
||||
/*
|
||||
xmlDocDumpMemoryEnc(doc_return, &buf, &size, XML_CHAR_ENCODING_UTF8);
|
||||
*/
|
||||
xmlDocDumpMemory(doc_return, &buf, &size);
|
||||
sprintf(cont_len,"Content-Length: %d\0", size);
|
||||
sapi_add_header(cont_len, strlen(cont_len) + 1, 1);
|
||||
sapi_add_header("Content-Type: text/xml", sizeof("Content-Type: text/xml"), 1);
|
||||
|
||||
// Want to return HTTP 500 but apache wants to over write
|
||||
// our fault code with their own handling... Figure this out later
|
||||
// sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error"), 1);
|
||||
/*
|
||||
Want to return HTTP 500 but apache wants to over write
|
||||
our fault code with their own handling... Figure this out later
|
||||
sapi_add_header("HTTP/1.1 500 Internal Service Error", sizeof("HTTP/1.1 500 Internal Service Error"), 1);
|
||||
*/
|
||||
php_write(buf, size TSRMLS_CC);
|
||||
|
||||
xmlFreeDoc(doc_return);
|
||||
@ -1127,7 +1136,7 @@ void soap_error_handler(int error_num, const char *error_filename, const uint er
|
||||
}
|
||||
}
|
||||
|
||||
// SoapObject functions
|
||||
/* SoapObject functions */
|
||||
PHP_FUNCTION(soapobject)
|
||||
{
|
||||
char *location, *uri = NULL;
|
||||
@ -1140,13 +1149,13 @@ PHP_FUNCTION(soapobject)
|
||||
{
|
||||
if(uri)
|
||||
{
|
||||
// if two parameters assume 'proxy' and 'uri'
|
||||
/* if two parameters assume 'proxy' and 'uri' */
|
||||
add_property_stringl(thisObj, "location", location, location_len, 1);
|
||||
add_property_stringl(thisObj, "uri", uri, uri_len, 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
// if one parameter assume 'wsdl'
|
||||
/* if one parameter assume 'wsdl' */
|
||||
sdlPtr sdl;
|
||||
int ret;
|
||||
|
||||
@ -1498,8 +1507,10 @@ void soap_call_function_handler(INTERNAL_FUNCTION_PARAMETERS, zend_property_refe
|
||||
|
||||
GET_THIS_OBJECT(thisObj);
|
||||
|
||||
//Find if the function being called is already defined...
|
||||
// ( IMHO: zend should handle this functionality )
|
||||
/*
|
||||
Find if the function being called is already defined...
|
||||
( IMHO: zend should handle this functionality )
|
||||
*/
|
||||
if(zend_hash_find(&Z_OBJCE_P(thisObj)->function_table, function, Z_STRLEN(function_name->element) + 1, (void **) &builtin_function) == SUCCESS)
|
||||
{
|
||||
builtin_function->internal_function.handler(INTERNAL_FUNCTION_PARAM_PASSTHRU);
|
||||
@ -1652,7 +1663,7 @@ void deseralize_function_call(sdlPtr sdl, xmlDocPtr request, zval *function_name
|
||||
trav3 = body->children;
|
||||
do
|
||||
{
|
||||
// TODO: make 'strict' (use th sdl defnintions)
|
||||
/* TODO: make 'strict' (use th sdl defnintions) */
|
||||
if(trav3->type == XML_ELEMENT_NODE)
|
||||
{
|
||||
zval tmp_function_name, **tmp_parameters;
|
||||
@ -2057,7 +2068,7 @@ static void type_to_string(sdlTypePtr type, smart_str *buf, int level)
|
||||
}
|
||||
}
|
||||
|
||||
//Deletes
|
||||
/* Deletes */
|
||||
void delete_sdl(void *handle)
|
||||
{
|
||||
sdlPtr tmp = *((sdlPtr*)handle);
|
||||
@ -2230,7 +2241,7 @@ void delete_mapping(void *data)
|
||||
efree(map);
|
||||
}
|
||||
|
||||
// Should not need
|
||||
/* Should not need */
|
||||
int my_call_user_function(HashTable *function_table, zval **object_pp, zval *function_name, zval *retval_ptr, int param_count, zval *params[] TSRMLS_DC)
|
||||
{
|
||||
if(call_user_function(function_table, object_pp, function_name, retval_ptr, param_count, params TSRMLS_CC) == FAILURE)
|
||||
@ -2257,7 +2268,7 @@ int my_call_user_function(HashTable *function_table, zval **object_pp, zval *fun
|
||||
zend_llist_init(property_reference.elements_list, sizeof(zend_overloaded_element), NULL, 0);
|
||||
zend_llist_add_element(property_reference.elements_list, &overloaded_element);
|
||||
|
||||
//Build argument stack
|
||||
/* Build argument stack */
|
||||
for(i = 0;i < param_count;i++)
|
||||
zend_ptr_stack_push(&EG(argument_stack), params[i]);
|
||||
zend_ptr_stack_n_push(&EG(argument_stack), 2, (void *)param_count, NULL);
|
||||
|
Loading…
Reference in New Issue
Block a user