Compare commits

...
10 changed files with 71 additions and 1328 deletions

No files matched your search

+8 -27
View File
@@ -211,9 +211,6 @@ encode defaultEncoding[] = {
{{END_KNOWN_TYPES, NULL, NULL, NULL}, guess_zval_convert, guess_xml_convert}
};
int numDefaultEncodings = sizeof(defaultEncoding)/sizeof(encode);
void whiteSpace_replace(char* str)
{
while (*str != '\0') {
@@ -1131,13 +1128,11 @@ static void model_to_zval_object(zval *ret, sdlContentModelPtr model, xmlNodePtr
{
switch (model->kind) {
case XSD_CONTENT_ELEMENT:
if (model->u.element->name) {
xmlNodePtr node = get_node(data->children, model->u.element->name);
if (model->u.element->name) {
xmlNodePtr node = get_node(data->children, model->u.element->name);
if (node) {
zval *val;
if (node) {
zval *val;
node = check_and_resolve_href(node);
if (node && node->children && node->children->content) {
if (model->u.element->fixed && strcmp(model->u.element->fixed,node->children->content) != 0) {
soap_error3(E_ERROR, "Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)", model->u.element->name, model->u.element->fixed, node->children->content);
@@ -2883,11 +2878,11 @@ zval *sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data)
}
if (type->restrictions->minLength &&
strlen(data->children->content) < type->restrictions->minLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'");
soap_error0(E_WARNING, "Encoding: Restriction: length less then 'minLength'");
}
if (type->restrictions->maxLength &&
strlen(data->children->content) > type->restrictions->maxLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'");
soap_error0(E_WARNING, "Encoding: Restriction: length greater then 'maxLength'");
}
if (type->restrictions->length &&
strlen(data->children->content) != type->restrictions->length->value) {
@@ -2946,11 +2941,11 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo
}
if (type->restrictions->minLength &&
Z_STRLEN_P(data) < type->restrictions->minLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length less than 'minLength'");
soap_error0(E_WARNING, "Encoding: Restriction: length less then 'minLength'");
}
if (type->restrictions->maxLength &&
Z_STRLEN_P(data) > type->restrictions->maxLength->value) {
soap_error0(E_WARNING, "Encoding: Restriction: length greater than 'maxLength'");
soap_error0(E_WARNING, "Encoding: Restriction: length greater then 'maxLength'");
}
if (type->restrictions->length &&
Z_STRLEN_P(data) != type->restrictions->length->value) {
@@ -3305,17 +3300,3 @@ void delete_encoder(void *encode)
}
efree(t);
}
void delete_encoder_persistent(void *encode)
{
encodePtr t = *((encodePtr*)encode);
if (t->details.ns) {
free(t->details.ns);
}
if (t->details.type_str) {
free(t->details.type_str);
}
/* we should never have mapping in persistent encoder */
assert(t->details.map == NULL);
free(t);
}
-2
View File
@@ -219,9 +219,7 @@ xmlNsPtr encode_add_ns(xmlNodePtr node, const char* ns);
encodePtr get_conversion(int encode);
void delete_encoder(void *handle);
void delete_encoder_persistent(void *handle);
extern encode defaultEncoding[];
extern int numDefaultEncodings;
#endif
+3 -12
View File
@@ -416,22 +416,13 @@ try_again:
smart_str_appendc(&soap_headers, ':');
smart_str_append_unsigned(&soap_headers, phpurl->port);
}
smart_str_append_const(&soap_headers, "\r\n"
"Connection: Keep-Alive\r\n");
smart_str_append_const(&soap_headers, "\r\n"
"Connection: Keep-Alive\r\n"
/*
"Connection: close\r\n"
"Accept: text/html; text/xml; text/plain\r\n"
*/
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
if (Z_STRLEN_PP(tmp) > 0) {
smart_str_append_const(&soap_headers, "User-Agent: ");
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
smart_str_append_const(&soap_headers, "\r\n");
}
} else{
smart_str_append_const(&soap_headers, "User-Agent: PHP-SOAP/"PHP_VERSION"\r\n");
}
"User-Agent: PHP SOAP 0.1\r\n");
smart_str_append(&soap_headers, &soap_headers_z);
smart_str_free(&soap_headers_z);
-127
View File
@@ -2358,28 +2358,6 @@ void delete_model(void *handle)
efree(tmp);
}
void delete_model_persistent(void *handle)
{
sdlContentModelPtr tmp = *((sdlContentModelPtr*)handle);
switch (tmp->kind) {
case XSD_CONTENT_ELEMENT:
case XSD_CONTENT_GROUP:
break;
case XSD_CONTENT_SEQUENCE:
case XSD_CONTENT_ALL:
case XSD_CONTENT_CHOICE:
zend_hash_destroy(tmp->u.content);
free(tmp->u.content);
break;
case XSD_CONTENT_GROUP_REF:
free(tmp->u.group_ref);
break;
default:
break;
}
free(tmp);
}
void delete_type(void *data)
{
sdlTypePtr type = *((sdlTypePtr*)data);
@@ -2427,53 +2405,6 @@ void delete_type(void *data)
efree(type);
}
void delete_type_persistent(void *data)
{
sdlTypePtr type = *((sdlTypePtr*)data);
if (type->name) {
free(type->name);
}
if (type->namens) {
free(type->namens);
}
if (type->def) {
free(type->def);
}
if (type->fixed) {
free(type->fixed);
}
if (type->elements) {
zend_hash_destroy(type->elements);
free(type->elements);
}
if (type->attributes) {
zend_hash_destroy(type->attributes);
free(type->attributes);
}
if (type->model) {
delete_model_persistent((void**)&type->model);
}
if (type->restrictions) {
delete_restriction_var_int_persistent(&type->restrictions->minExclusive);
delete_restriction_var_int_persistent(&type->restrictions->minInclusive);
delete_restriction_var_int_persistent(&type->restrictions->maxExclusive);
delete_restriction_var_int_persistent(&type->restrictions->maxInclusive);
delete_restriction_var_int_persistent(&type->restrictions->totalDigits);
delete_restriction_var_int_persistent(&type->restrictions->fractionDigits);
delete_restriction_var_int_persistent(&type->restrictions->length);
delete_restriction_var_int_persistent(&type->restrictions->minLength);
delete_restriction_var_int_persistent(&type->restrictions->maxLength);
delete_restriction_var_char_persistent(&type->restrictions->whiteSpace);
delete_restriction_var_char_persistent(&type->restrictions->pattern);
if (type->restrictions->enumeration) {
zend_hash_destroy(type->restrictions->enumeration);
free(type->restrictions->enumeration);
}
free(type->restrictions);
}
free(type);
}
void delete_extra_attribute(void *attribute)
{
sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute);
@@ -2487,19 +2418,6 @@ void delete_extra_attribute(void *attribute)
efree(attr);
}
void delete_extra_attribute_persistent(void *attribute)
{
sdlExtraAttributePtr attr = *((sdlExtraAttributePtr*)attribute);
if (attr->ns) {
free(attr->ns);
}
if (attr->val) {
free(attr->val);
}
free(attr);
}
void delete_attribute(void *attribute)
{
sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
@@ -2526,32 +2444,6 @@ void delete_attribute(void *attribute)
efree(attr);
}
void delete_attribute_persistent(void *attribute)
{
sdlAttributePtr attr = *((sdlAttributePtr*)attribute);
if (attr->def) {
free(attr->def);
}
if (attr->fixed) {
free(attr->fixed);
}
if (attr->name) {
free(attr->name);
}
if (attr->namens) {
free(attr->namens);
}
if (attr->ref) {
free(attr->ref);
}
if (attr->extraAttributes) {
zend_hash_destroy(attr->extraAttributes);
free(attr->extraAttributes);
}
free(attr);
}
void delete_restriction_var_int(void *rvi)
{
sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
@@ -2560,14 +2452,6 @@ void delete_restriction_var_int(void *rvi)
}
}
void delete_restriction_var_int_persistent(void *rvi)
{
sdlRestrictionIntPtr ptr = *((sdlRestrictionIntPtr*)rvi);
if (ptr) {
free(ptr);
}
}
void delete_restriction_var_char(void *srvc)
{
sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
@@ -2578,14 +2462,3 @@ void delete_restriction_var_char(void *srvc)
efree(ptr);
}
}
void delete_restriction_var_char_persistent(void *srvc)
{
sdlRestrictionCharPtr ptr = *((sdlRestrictionCharPtr*)srvc);
if (ptr) {
if (ptr->value) {
free(ptr->value);
}
free(ptr);
}
}
-6
View File
@@ -26,15 +26,9 @@ int load_schema(sdlCtx *ctx, xmlNodePtr schema TSRMLS_DC);
void schema_pass2(sdlCtx *ctx);
void delete_model(void *handle);
void delete_model_persistent(void *handle);
void delete_type(void *data);
void delete_type_persistent(void *data);
void delete_extra_attribute(void *attribute);
void delete_extra_attribute_persistent(void *attribute);
void delete_attribute(void *attribute);
void delete_attribute_persistent(void *attribute);
void delete_restriction_var_int(void *rvi);
void delete_restriction_var_int_persistent(void *rvi);
void delete_restriction_var_char(void *srvc);
void delete_restriction_var_char_persistent(void *srvc);
#endif
+46 -1064
View File
File diff suppressed because it is too large. Load diff
+1 -4
View File
@@ -61,7 +61,6 @@ struct _sdl {
HashTable *groups; /* array of sdlTypesPtr */
char *target_ns;
char *source;
zend_bool is_persistent;
};
typedef struct sdlCtx {
@@ -251,8 +250,7 @@ struct _sdlAttribute {
encodePtr encode;
};
sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC);
sdlPtr get_sdl(zval *this_ptr, char *uri TSRMLS_DC);
encodePtr get_encoder_from_prefix(sdlPtr sdl, xmlNodePtr data, const char *type);
encodePtr get_encoder(sdlPtr sdl, const char *ns, const char *type);
@@ -262,6 +260,5 @@ sdlBindingPtr get_binding_from_type(sdlPtr sdl, int type);
sdlBindingPtr get_binding_from_name(sdlPtr sdl, char *name, char *ns);
void delete_sdl(void *handle);
void delete_sdl_impl(void *handle);
#endif
+1 -9
View File
@@ -158,11 +158,6 @@ struct _soapService {
#define SOAP_SINGLE_ELEMENT_ARRAYS (1<<0)
#define SOAP_WAIT_ONE_WAY_CALLS (2<<0)
#define WSDL_CACHE_NONE 0x0
#define WSDL_CACHE_DISK 0x1
#define WSDL_CACHE_MEMORY 0x2
#define WSDL_CACHE_BOTH 0x3
ZEND_BEGIN_MODULE_GLOBALS(soap)
HashTable defEncNs; /* mapping of default namespaces to prefixes */
HashTable defEnc;
@@ -174,15 +169,12 @@ ZEND_BEGIN_MODULE_GLOBALS(soap)
zend_bool use_soap_error_handler;
char* error_code;
zval* error_object;
long cache;
zend_bool cache_enabled;
char* cache_dir;
long cache_ttl;
long cache_limit;
HashTable *mem_cache;
xmlCharEncodingHandlerPtr encoding;
HashTable *class_map;
int features;
HashTable wsdl_cache;
ZEND_END_MODULE_GLOBALS(soap)
#ifdef PHP_WIN32
+11 -76
View File
@@ -391,49 +391,18 @@ zend_module_entry soap_module_entry = {
ZEND_GET_MODULE(soap)
#endif
#ifndef ZEND_ENGINE_2
# define OnUpdateLong OnUpdateInt
#endif
ZEND_API ZEND_INI_MH(OnUpdateCacheEnabled)
{
long *p;
#ifndef ZTS
char *base = (char *) mh_arg2;
#else
char *base;
base = (char *) ts_resource(*((int *) mh_arg2));
#endif
p = (long*) (base+(size_t) mh_arg1);
if (new_value_length==2 && strcasecmp("on", new_value)==0) {
*p = 1;
}
else if (new_value_length==3 && strcasecmp("yes", new_value)==0) {
*p = 1;
}
else if (new_value_length==4 && strcasecmp("true", new_value)==0) {
*p = 1;
}
else {
*p = (long) (atoi(new_value) != 0);
}
return SUCCESS;
}
PHP_INI_BEGIN()
STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateCacheEnabled,
cache, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_enabled", "1", PHP_INI_ALL, OnUpdateBool,
cache_enabled, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_dir", "/tmp", PHP_INI_ALL, OnUpdateString,
cache_dir, zend_soap_globals, soap_globals)
#ifdef ZEND_ENGINE_2
STD_PHP_INI_ENTRY("soap.wsdl_cache_ttl", "86400", PHP_INI_ALL, OnUpdateLong,
cache_ttl, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache", "1", PHP_INI_ALL, OnUpdateLong,
cache, zend_soap_globals, soap_globals)
STD_PHP_INI_ENTRY("soap.wsdl_cache_limit", "5", PHP_INI_ALL, OnUpdateLong,
cache_limit, zend_soap_globals, soap_globals)
#else
STD_PHP_INI_ENTRY("soap.wsdl_cache_ttl", "86400", PHP_INI_ALL, OnUpdateInt,
cache_ttl, zend_soap_globals, soap_globals)
#endif
PHP_INI_END()
static HashTable defEnc, defEncIndex, defEncNs;
@@ -490,7 +459,6 @@ static void php_soap_init_globals(zend_soap_globals *soap_globals TSRMLS_DC)
soap_globals->error_object = NULL;
soap_globals->sdl = NULL;
soap_globals->soap_version = SOAP_1_1;
soap_globals->mem_cache = NULL;
}
PHP_MSHUTDOWN_FUNCTION(soap)
@@ -499,10 +467,6 @@ PHP_MSHUTDOWN_FUNCTION(soap)
zend_hash_destroy(&SOAP_GLOBAL(defEnc));
zend_hash_destroy(&SOAP_GLOBAL(defEncIndex));
zend_hash_destroy(&SOAP_GLOBAL(defEncNs));
if (SOAP_GLOBAL(mem_cache)) {
zend_hash_destroy(SOAP_GLOBAL(mem_cache));
free(SOAP_GLOBAL(mem_cache));
}
UNREGISTER_INI_ENTRIES();
return SUCCESS;
}
@@ -528,7 +492,7 @@ PHP_MINIT_FUNCTION(soap)
/* TODO: add ini entry for always use soap errors */
php_soap_prepare_globals();
ZEND_INIT_MODULE_GLOBALS(soap, php_soap_init_globals, NULL);
REGISTER_INI_ENTRIES();
REGISTER_INI_ENTRIES();
#ifndef ZEND_ENGINE_2
/* Enable php stream/wrapper support for libxml */
@@ -675,11 +639,6 @@ PHP_MINIT_FUNCTION(soap)
REGISTER_LONG_CONSTANT("SOAP_SINGLE_ELEMENT_ARRAYS", SOAP_SINGLE_ELEMENT_ARRAYS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SOAP_WAIT_ONE_WAY_CALLS", SOAP_WAIT_ONE_WAY_CALLS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("WSDL_CACHE_NONE", WSDL_CACHE_NONE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("WSDL_CACHE_DISK", WSDL_CACHE_DISK, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("WSDL_CACHE_MEMORY", WSDL_CACHE_MEMORY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("WSDL_CACHE_BOTH", WSDL_CACHE_BOTH, CONST_CS | CONST_PERSISTENT);
old_error_handler = zend_error_cb;
zend_error_cb = soap_error_handler;
@@ -946,7 +905,6 @@ PHP_METHOD(SoapServer, SoapServer)
zval *wsdl, *options = NULL;
int ret;
int version = SOAP_1_1;
long cache_wsdl;
SOAP_SERVER_BEGIN_CODE();
@@ -964,8 +922,6 @@ PHP_METHOD(SoapServer, SoapServer)
service = emalloc(sizeof(soapService));
memset(service, 0, sizeof(soapService));
cache_wsdl = SOAP_GLOBAL(cache);
if (options != NULL) {
HashTable *ht = Z_ARRVAL_P(options);
zval **tmp;
@@ -1016,11 +972,6 @@ PHP_METHOD(SoapServer, SoapServer)
service->features = Z_LVAL_PP(tmp);
}
if (zend_hash_find(ht, "cache_wsdl", sizeof("cache_wsdl"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_LONG) {
cache_wsdl = Z_LVAL_PP(tmp);
}
} else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is required in nonWSDL mode.");
}
@@ -1032,7 +983,7 @@ PHP_METHOD(SoapServer, SoapServer)
zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
if (wsdl) {
service->sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl), cache_wsdl TSRMLS_CC);
service->sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl) TSRMLS_CC);
if (service->uri == NULL) {
if (service->sdl->target_ns) {
service->uri = estrdup(service->sdl->target_ns);
@@ -1702,9 +1653,7 @@ PHP_METHOD(SoapServer, handle)
}
fn_name = estrndup(Z_STRVAL(h->function_name),Z_STRLEN(h->function_name));
if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) + 1) ||
(service->type == SOAP_CLASS &&
zend_hash_exists(function_table, ZEND_CALL_FUNC_NAME, sizeof(ZEND_CALL_FUNC_NAME)))) {
if (zend_hash_exists(function_table, php_strtolower(fn_name, Z_STRLEN(h->function_name)), Z_STRLEN(h->function_name) + 1)) {
if (service->type == SOAP_CLASS) {
call_status = call_user_function(NULL, &soap_obj, &h->function_name, &h->retval, h->num_params, h->parameters TSRMLS_CC);
} else {
@@ -2151,7 +2100,6 @@ PHP_METHOD(SoapClient, SoapClient)
zval *options = NULL;
int soap_version = SOAP_1_1;
php_stream_context *context = NULL;
long cache_wsdl;
SOAP_CLIENT_BEGIN_CODE();
@@ -2167,9 +2115,6 @@ PHP_METHOD(SoapClient, SoapClient)
} else {
wsdl = NULL;
}
cache_wsdl = SOAP_GLOBAL(cache);
if (options != NULL) {
HashTable *ht = Z_ARRVAL_P(options);
zval **tmp;
@@ -2317,16 +2262,6 @@ PHP_METHOD(SoapClient, SoapClient)
add_property_resource(this_ptr, "_stream_context", context->rsrc_id);
}
if (zend_hash_find(ht, "cache_wsdl", sizeof("cache_wsdl"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_LONG) {
cache_wsdl = Z_LVAL_PP(tmp);
}
if (zend_hash_find(ht, "user_agent", sizeof("user_agent"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
}
} else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are requred in nonWSDL mode");
return;
@@ -2341,7 +2276,7 @@ PHP_METHOD(SoapClient, SoapClient)
old_soap_version = SOAP_GLOBAL(soap_version);
SOAP_GLOBAL(soap_version) = soap_version;
sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl), cache_wsdl TSRMLS_CC);
sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl) TSRMLS_CC);
ret = zend_list_insert(sdl, le_sdl);
add_property_resource(this_ptr, "sdl", ret);
+1 -1
View File
@@ -42,7 +42,7 @@ function test($type, $num) {
try {
printf(" %0.0f\n ", $num);
$ret = $soap->foo($type, new SoapVar($num, $type));
printf(" %0.0f\n", $ret);
printf(" %0.0f\n", $num, $ret);
} catch (SoapFault $ex) {
var_dump($ex);
}