diff options
author | Dmitry Stogov <dmitry@php.net> | 2004-05-05 10:31:26 +0000 |
---|---|---|
committer | Dmitry Stogov <dmitry@php.net> | 2004-05-05 10:31:26 +0000 |
commit | 7bddbd7bd061325dae29315538f71939aa51130d (patch) | |
tree | 814a94bdb046c40e5dd99a22995346fdf3abd51f | |
parent | fd0ec1cb45b8a98d48f0349624b83a12d7905e26 (diff) | |
download | php-git-7bddbd7bd061325dae29315538f71939aa51130d.tar.gz |
php_error() -> php_error_docref() (Marcus, Dmitry)
-rw-r--r-- | ext/soap/php_encoding.c | 92 | ||||
-rw-r--r-- | ext/soap/php_schema.c | 156 | ||||
-rw-r--r-- | ext/soap/php_sdl.c | 102 | ||||
-rw-r--r-- | ext/soap/php_soap.h | 12 | ||||
-rw-r--r-- | ext/soap/soap.c | 133 | ||||
-rw-r--r-- | ext/soap/tests/soap12/T28.phpt | 2 | ||||
-rw-r--r-- | ext/soap/tests/soap12/T69.phpt | 2 | ||||
-rw-r--r-- | ext/soap/tests/soap12/T70.phpt | 2 | ||||
-rw-r--r-- | ext/soap/tests/soap12/T71.phpt | 2 | ||||
-rw-r--r-- | ext/soap/tests/soap12/T72.phpt | 2 |
10 files changed, 259 insertions, 246 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c index 5bda11a881..7174eb9f16 100644 --- a/ext/soap/php_encoding.c +++ b/ext/soap/php_encoding.c @@ -251,7 +251,7 @@ xmlNodePtr master_to_xml(encodePtr encode, zval *data, int style, xmlNodePtr par HashTable *ht = Z_OBJPROP_P(data); if (zend_hash_find(ht, "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: SoapVar hasn't 'enc_type' propery"); + soap_error0(E_ERROR, "Encoding: SoapVar hasn't 'enc_type' propery"); } if (SOAP_GLOBAL(sdl) && encode == NULL) { @@ -338,7 +338,7 @@ zval *to_xml_before_user(encodeTypePtr type, zval *data) if (type.map->map_functions.to_xml_before) { if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_before, data, 1, &data TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_xml_before"); + soap_error0(E_ERROR, "Encoding: Error calling to_xml_before"); } } return data; @@ -353,11 +353,11 @@ xmlNodePtr to_xml_user(encodeTypePtr type, zval *data, int style, xmlNodePtr par if (type.map->map_functions.to_xml) { MAKE_STD_ZVAL(ret); if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml, ret, 1, &data TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_xml"); + soap_error0(E_ERROR, "Encoding: Error calling to_xml"); } if (Z_TYPE_P(ret) != IS_OBJECT) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Error serializing object from to_xml_user"); + soap_error0(E_ERROR, "Encoding: Error serializing object from to_xml_user"); } if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) { @@ -382,7 +382,7 @@ xmlNodePtr to_xml_after_user(encodeTypePtr type, xmlNodePtr node, int style) param = php_domobject_new(node, &found, NULL TSRMLS_CC); if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_xml_after, ret, 1, ¶m TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_xml_after"); + soap_error0(E_ERROR, "Encoding: Error calling to_xml_after"); } if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) { node = (xmlNodePtr)Z_LVAL_PP(addr); @@ -406,7 +406,7 @@ xmlNodePtr to_zval_before_user(encodeTypePtr type, xmlNodePtr node, int style) param = php_domobject_new(node, &found, NULL TSRMLS_CC); if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_before, ret, 1, ¶m TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval_before"); + soap_error0(E_ERROR, "Encoding: Error calling to_zval_before"); } if (zend_hash_index_find(Z_OBJPROP_P(ret), 1, (void **)&addr) == SUCCESS) { node = (xmlNodePtr)Z_LVAL_PP(addr); @@ -430,7 +430,7 @@ zval *to_zval_user(encodeTypePtr type, xmlNodePtr node) param = php_domobject_new(node, &found, NULL TSRMLS_CC); if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval, ret, 1, ¶m TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval"); + soap_error0(E_ERROR, "Encoding: Error calling to_zval"); } zval_ptr_dtor(¶m); efree(param); @@ -444,7 +444,7 @@ zval *to_zval_after_user(encodeTypePtr type, zval *data) if (type.map->map_functions.to_zval_after) { if (call_user_function(EG(function_table), NULL, type.map->map_functions.to_zval_after, data, 1, &data TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Error calling to_zval_after"); + soap_error0(E_ERROR, "Encoding: Error calling to_zval_after"); } } return data; @@ -464,7 +464,7 @@ static zval *to_zval_string(encodeTypePtr type, xmlNodePtr data) } else if (data->children->type == XML_CDATA_SECTION_NODE && data->children->next == NULL) { ZVAL_STRING(ret, data->children->content, 1); } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } else { ZVAL_EMPTY_STRING(ret); @@ -484,7 +484,7 @@ static zval *to_zval_stringr(encodeTypePtr type, xmlNodePtr data) } else if (data->children->type == XML_CDATA_SECTION_NODE && data->children->next == NULL) { ZVAL_STRING(ret, data->children->content, 1); } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } else { ZVAL_EMPTY_STRING(ret); @@ -504,7 +504,7 @@ static zval *to_zval_stringc(encodeTypePtr type, xmlNodePtr data) } else if (data->children->type == XML_CDATA_SECTION_NODE && data->children->next == NULL) { ZVAL_STRING(ret, data->children->content, 1); } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } else { ZVAL_EMPTY_STRING(ret); @@ -579,7 +579,7 @@ static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data) whiteSpace_collapse(data->children->content); ZVAL_DOUBLE(ret, atof(data->children->content)); } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } else { ZVAL_NULL(ret); @@ -598,7 +598,7 @@ static zval *to_zval_long(encodeTypePtr type, xmlNodePtr data) whiteSpace_collapse(data->children->content); ZVAL_LONG(ret, atol(data->children->content)); } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } else { ZVAL_NULL(ret); @@ -624,7 +624,7 @@ static zval *to_zval_ulong(encodeTypePtr type, xmlNodePtr data) ret->type = IS_LONG; } } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } else { ZVAL_NULL(ret); @@ -727,7 +727,7 @@ static zval *to_zval_bool(encodeTypePtr type, xmlNodePtr data) ZVAL_BOOL(ret, 0); } } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } } else { ZVAL_NULL(ret); @@ -799,7 +799,7 @@ static void model_to_zval_object(zval *ret, sdlContentModelPtr model, xmlNodePtr if (node && node->children && node->children->content) { if (model->u.element->fixed && strcmp(model->u.element->fixed,node->children->content) != 0) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)",model->u.element->name,model->u.element->fixed,node->children->content); + 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); } val = master_to_zval(model->u.element->encode, node); } else if (model->u.element->fixed) { @@ -824,7 +824,7 @@ static void model_to_zval_object(zval *ret, sdlContentModelPtr model, xmlNodePtr do { if (node && node->children && node->children->content) { if (model->u.element->fixed && strcmp(model->u.element->fixed,node->children->content) != 0) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)",model->u.element->name,model->u.element->fixed,node->children->content); + 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); } val = master_to_zval(model->u.element->encode, node); } else if (model->u.element->fixed) { @@ -952,7 +952,7 @@ static zval *to_zval_object(encodeTypePtr type, xmlNodePtr data) if (val && val->children && val->children->content) { str_val = val->children->content; if ((*attr)->fixed && strcmp((*attr)->fixed,str_val) != 0) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)",(*attr)->name,(*attr)->fixed,str_val); + soap_error3(E_ERROR, "Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)", (*attr)->name, (*attr)->fixed, str_val); } } else if ((*attr)->fixed) { str_val = (*attr)->fixed; @@ -1029,7 +1029,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, HashTa property = master_to_xml(enc, *val, style, node); if (property->children && property->children->content && model->u.element->fixed && strcmp(model->u.element->fixed,property->children->content) != 0) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)",model->u.element->name,model->u.element->fixed,property->children->content); + soap_error3(E_ERROR, "Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)", model->u.element->name, model->u.element->fixed, property->children->content); } } xmlNodeSetName(property, model->u.element->name); @@ -1053,7 +1053,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, HashTa property = master_to_xml(enc, *data, style, node); if (property->children && property->children->content && model->u.element->fixed && strcmp(model->u.element->fixed,property->children->content) != 0) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)",model->u.element->name,model->u.element->fixed,property->children->content); + soap_error3(E_ERROR, "Encoding: Element '%s' has fixed value '%s' (value '%s' is not allowed)", model->u.element->name, model->u.element->fixed, property->children->content); } } xmlNodeSetName(property, model->u.element->name); @@ -1067,7 +1067,7 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, HashTa return 2; } else { if (strict) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: object hasn't '%s' property",model->u.element->name); + soap_error1(E_ERROR, "Encoding: object hasn't '%s' property", model->u.element->name); } return 0; } @@ -1268,7 +1268,7 @@ static xmlNodePtr to_xml_object(encodeTypePtr type, zval *data, int style, xmlNo dummy = master_to_xml((*attr)->encode, *data, SOAP_LITERAL, xmlParam); if (dummy->children && dummy->children->content) { if ((*attr)->fixed && strcmp((*attr)->fixed,dummy->children->content) != 0) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)",(*attr)->name,(*attr)->fixed,dummy->children->content); + soap_error3(E_ERROR, "Encoding: Attribute '%s' has fixed value '%s' (value '%s' is not allowed)", (*attr)->name, (*attr)->fixed, dummy->children->content); } xmlSetProp(xmlParam, (*attr)->name, dummy->children->content); } @@ -1360,7 +1360,7 @@ static int calc_dimension_12(const char* str) flag = 1; } } else if (*str == '*') { - php_error(E_ERROR,"SOAP-ERROR: Encoding: '*' may only be first arraySize value in list"); + soap_error0(E_ERROR, "Encoding: '*' may only be first arraySize value in list"); } else { flag = 0; } @@ -1391,7 +1391,7 @@ static int* get_position_12(int dimension, const char* str) } pos[i] = (pos[i]*10)+(*str-'0'); } else if (*str == '*') { - php_error(E_ERROR,"SOAP-ERROR: Encoding: '*' may only be first arraySize value in list"); + soap_error0(E_ERROR, "Encoding: '*' may only be first arraySize value in list"); } else { flag = 0; } @@ -2001,12 +2001,12 @@ static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data) FOREACHNODE(trav, "item", item) { xmlKey = get_node(item->children, "key"); if (!xmlKey) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Can't decode apache map, missing key"); + soap_error0(E_ERROR, "Encoding: Can't decode apache map, missing key"); } xmlValue = get_node(item->children, "value"); if (!xmlKey) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Can't decode apache map, missing value"); + soap_error0(E_ERROR, "Encoding: Can't decode apache map, missing value"); } key = master_to_zval(NULL, xmlKey); @@ -2017,7 +2017,7 @@ static zval *to_zval_map(encodeTypePtr type, xmlNodePtr data) } else if (Z_TYPE_P(key) == IS_LONG) { zend_hash_index_update(Z_ARRVAL_P(ret), Z_LVAL_P(key), &value, sizeof(zval *), NULL); } else { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Can't decode apache map, only Strings or Longs are allowd as keys"); + soap_error0(E_ERROR, "Encoding: Can't decode apache map, only Strings or Longs are allowd as keys"); } zval_ptr_dtor(&key); } @@ -2275,7 +2275,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP } smart_str_appends(&list, dummy->children->content); } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } xmlUnlinkNode(dummy); xmlFreeNode(dummy); @@ -2314,7 +2314,7 @@ static xmlNodePtr to_xml_list(encodeTypePtr enc, zval *data, int style, xmlNodeP } smart_str_appends(&list, dummy->children->content); } else { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of encoding rules"); + soap_error0(E_ERROR, "Encoding: Violation of encoding rules"); } xmlUnlinkNode(dummy); xmlFreeNode(dummy); @@ -2362,20 +2362,20 @@ zval *sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data) } if (type->restrictions->enumeration) { if (!zend_hash_exists(type->restrictions->enumeration,data->children->content,strlen(data->children->content)+1)) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: invalid enumeration value \"%s\"",data->children->content); + soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\"", data->children->content); } } if (type->restrictions->minLength && strlen(data->children->content) < type->restrictions->minLength->value) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length less then 'minLength'"); + soap_error0(E_WARNING, "Encoding: Restriction: length less then 'minLength'"); } if (type->restrictions->maxLength && strlen(data->children->content) > type->restrictions->maxLength->value) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length greater then 'maxLength'"); + soap_error0(E_WARNING, "Encoding: Restriction: length greater then 'maxLength'"); } if (type->restrictions->length && strlen(data->children->content) != type->restrictions->length->value) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length is not equal to 'length'"); + soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'"); } } */ @@ -2401,7 +2401,7 @@ zval *sdl_guess_convert_zval(encodeTypePtr enc, xmlNodePtr data) } return to_zval_object(enc, data); default: - php_error(E_ERROR,"SOAP-ERROR: Encoding: Internal Error"); + soap_error0(E_ERROR, "Encoding: Internal Error"); return guess_zval_convert(enc, data); } } @@ -2418,20 +2418,20 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo if (type->restrictions && Z_TYPE_P(data) == IS_STRING) { if (type->restrictions->enumeration) { if (!zend_hash_exists(type->restrictions->enumeration,Z_STRVAL_P(data),Z_STRLEN_P(data)+1)) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: invalid enumeration value \"%s\".",Z_STRVAL_P(data)); + soap_error1(E_WARNING, "Encoding: Restriction: invalid enumeration value \"%s\".", Z_STRVAL_P(data)); } } if (type->restrictions->minLength && Z_STRLEN_P(data) < type->restrictions->minLength->value) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length less then 'minLength'"); + soap_error0(E_WARNING, "Encoding: Restriction: length less then 'minLength'"); } if (type->restrictions->maxLength && Z_STRLEN_P(data) > type->restrictions->maxLength->value) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length greater then 'maxLength'"); + soap_error0(E_WARNING, "Encoding: Restriction: length greater then 'maxLength'"); } if (type->restrictions->length && Z_STRLEN_P(data) != type->restrictions->length->value) { - php_error(E_WARNING,"SOAP-ERROR: Encoding: Restriction: length is not equal to 'length'"); + soap_error0(E_WARNING, "Encoding: Restriction: length is not equal to 'length'"); } } } @@ -2462,7 +2462,7 @@ xmlNodePtr sdl_guess_convert_xml(encodeTypePtr enc, zval *data, int style, xmlNo } break; default: - php_error(E_ERROR,"SOAP-ERROR: Encoding: Internal Error"); + soap_error0(E_ERROR, "Encoding: Internal Error"); break; } if (style == SOAP_ENCODED) { @@ -2487,12 +2487,12 @@ static xmlNodePtr check_and_resolve_href(xmlNodePtr data) if (href->children->content[0] == '#') { xmlNodePtr ret = get_node_with_attribute_recursive(data->doc->children, NULL, "id", &href->children->content[1]); if (!ret) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Unresolved reference '%s'",href->children->content); + soap_error1(E_ERROR, "Encoding: Unresolved reference '%s'", href->children->content); } return ret; } else { /* TODO: External href....? */ - php_error(E_ERROR,"SOAP-ERROR: Encoding: External reference '%s'",href->children->content); + soap_error1(E_ERROR, "Encoding: External reference '%s'", href->children->content); } } /* SOAP 1.2 enc:id enc:ref */ @@ -2508,9 +2508,9 @@ static xmlNodePtr check_and_resolve_href(xmlNodePtr data) } ret = get_node_with_attribute_recursive_ex(data->doc->children, NULL, NULL, "id", id, SOAP_1_2_ENC_NAMESPACE); if (!ret) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Unresolved reference '%s'",href->children->content); + soap_error1(E_ERROR, "Encoding: Unresolved reference '%s'", href->children->content); } else if (ret == data) { - php_error(E_ERROR,"SOAP-ERROR: Encoding: Violation of id and ref information items '%s'",href->children->content); + soap_error1(E_ERROR, "Encoding: Violation of id and ref information items '%s'", href->children->content); } return ret; } @@ -2582,14 +2582,14 @@ static encodePtr get_conversion(int encode) if (zend_hash_find(SOAP_GLOBAL(overrides), nscat.c, nscat.len + 1, (void **)&enc) == FAILURE) { smart_str_free(&nscat); - php_error(E_ERROR, "SOAP-ERROR: Encoding: Cannot find encoding"); + soap_error0(E_ERROR, "Encoding: Cannot find encoding"); return NULL; } else { smart_str_free(&nscat); return *enc; } } else { - php_error(E_ERROR, "SOAP-ERROR: Encoding: Cannot find encoding"); + soap_error0(E_ERROR, "Encoding: Cannot find encoding"); return NULL; } } else { @@ -2635,7 +2635,7 @@ static void get_array_type(xmlNodePtr node, zval *array, smart_str *type TSRMLS_ zval **ztype; if (zend_hash_find(Z_OBJPROP_PP(tmp), "enc_type", sizeof("enc_type"), (void **)&ztype) == FAILURE) { - php_error(E_ERROR, "SOAP-ERROR: Encoding: SoapVar hasn't 'enc_type' property"); + soap_error0(E_ERROR, "Encoding: SoapVar hasn't 'enc_type' property"); } cur_type = Z_LVAL_PP(ztype); diff --git a/ext/soap/php_schema.c b/ext/soap/php_schema.c index 985ec0ecc1..a1d7ed8514 100644 --- a/ext/soap/php_schema.c +++ b/ext/soap/php_schema.c @@ -114,22 +114,22 @@ static void schema_load_file(sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, xmlA doc = soap_xmlParseFile(location); if (doc == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s'",location); + soap_error1(E_ERROR, "Parsing Schema: can't import schema from '%s'", location); } schema = get_node(doc->children, "schema"); if (schema == NULL) { xmlFreeDoc(doc); - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s'",location); + soap_error1(E_ERROR, "Parsing Schema: can't import schema from '%s'", location); } new_tns = get_attribute(schema->properties, "targetNamespace"); if (import) { if (ns != NULL && (new_tns == NULL || strcmp(ns->children->content,new_tns->children->content) != 0)) { xmlFreeDoc(doc); - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s'",location,new_tns->children->content); + soap_error2(E_ERROR, "Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s'", location, new_tns->children->content); } if (ns == NULL && new_tns != NULL) { xmlFreeDoc(doc); - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s'",location,new_tns->children->content); + soap_error2(E_ERROR, "Parsing Schema: can't import schema from '%s', unexpected 'targetNamespace'='%s'", location, new_tns->children->content); } } else { new_tns = get_attribute(schema->properties, "targetNamespace"); @@ -140,7 +140,7 @@ static void schema_load_file(sdlCtx *ctx, xmlAttrPtr ns, xmlChar *location, xmlA } } else if (tns != NULL && strcmp(tns->children->content,new_tns->children->content) != 0) { xmlFreeDoc(doc); - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't include schema from '%s', different 'targetNamespace'",location); + soap_error1(E_ERROR, "Parsing Schema: can't include schema from '%s', different 'targetNamespace'", location); } } zend_hash_add(&ctx->docs, location, strlen(location)+1, (void**)&doc, sizeof(xmlDocPtr), NULL); @@ -199,7 +199,7 @@ int load_schema(sdlCtx *ctx,xmlNodePtr schema) location = get_attribute(trav->properties, "schemaLocation"); if (location == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: include has no 'schemaLocation' attribute"); + soap_error0(E_ERROR, "Parsing Schema: include has no 'schemaLocation' attribute"); } else { xmlChar *uri; xmlChar *base = xmlNodeGetBase(trav->doc, trav); @@ -219,7 +219,7 @@ int load_schema(sdlCtx *ctx,xmlNodePtr schema) location = get_attribute(trav->properties, "schemaLocation"); if (location == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: redefine has no 'schemaLocation' attribute"); + soap_error0(E_ERROR, "Parsing Schema: redefine has no 'schemaLocation' attribute"); } else { xmlChar *uri; xmlChar *base = xmlNodeGetBase(trav->doc, trav); @@ -243,7 +243,7 @@ int load_schema(sdlCtx *ctx,xmlNodePtr schema) location = get_attribute(trav->properties, "schemaLocation"); if (ns != NULL && tns != NULL && strcmp(ns->children->content,tns->children->content) == 0) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'",location->children->content); + soap_error1(E_ERROR, "Parsing Schema: can't import schema from '%s', namespace must not match the enclosing schema 'targetNamespace'", location->children->content); } if (location) { xmlChar *base = xmlNodeGetBase(trav->doc, trav); @@ -290,7 +290,7 @@ int load_schema(sdlCtx *ctx,xmlNodePtr schema) } else if (node_is_equal(trav,"annotation")) { /* TODO: <annotation> support */ } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in schema",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in schema", trav->name); } trav = trav->next; } @@ -371,7 +371,7 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType, create_encoder(sdl, cur_type, ns->children->content, name->children->content); } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: simpleType has no 'name' attribute"); + soap_error0(E_ERROR, "Parsing Schema: simpleType has no 'name' attribute"); } trav = simpleType->children; @@ -392,13 +392,13 @@ static int schema_simpleType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpleType, schema_union(sdl, tns, trav, cur_type); trav = trav->next; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleType",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in simpleType", trav->name); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: expected <restriction>, <list> or <union> in simpleType"); + soap_error0(E_ERROR, "Parsing Schema: expected <restriction>, <list> or <union> in simpleType"); } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleType",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in simpleType", trav->name); } return TRUE; @@ -454,7 +454,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP sdlTypePtr newType, *tmp; if (itemType != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'itemType' attribute and subtype"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'itemType' attribute and subtype"); } newType = emalloc(sizeof(sdlType)); @@ -473,7 +473,7 @@ static int schema_list(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr listType, sdlTypeP trav = trav->next; } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in list",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in list", trav->name); } return TRUE; } @@ -546,7 +546,7 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp sdlTypePtr newType, *tmp; if (memberTypes != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: union has both 'memberTypes' attribute and subtypes"); + soap_error0(E_ERROR, "Parsing Schema: union has both 'memberTypes' attribute and subtypes"); } newType = emalloc(sizeof(sdlType)); @@ -564,12 +564,12 @@ static int schema_union(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr unionType, sdlTyp schema_simpleType(sdl, tns, trav, newType); } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in union",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in union", trav->name); } trav = trav->next; } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in union",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in union", trav->name); } return TRUE; } @@ -600,13 +600,13 @@ static int schema_simpleContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr simpCompT schema_extension_simpleContent(sdl, tns, trav, cur_type); trav = trav->next; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleContent",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in simpleContent", trav->name); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: expected <restriction> or <extension> in simpleContent"); + soap_error0(E_ERROR, "Parsing Schema: expected <restriction> or <extension> in simpleContent"); } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in simpleContent",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in simpleContent", trav->name); } return TRUE; @@ -644,7 +644,7 @@ static int schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodeP if (type) {efree(type);} if (ns) {efree(ns);} } else if (!simpleType) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: restriction has no 'base' attribute"); + soap_error0(E_ERROR, "Parsing Schema: restriction has no 'base' attribute"); } if (cur_type->restrictions == NULL) { @@ -709,13 +709,13 @@ static int schema_restriction_simpleContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodeP trav = trav->next; break; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in restriction", trav->name); } trav = trav->next; } } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in restriction", trav->name); } return TRUE; @@ -747,7 +747,7 @@ static int schema_restriction_complexContent(sdlPtr sdl, xmlAttrPtr tns, xmlNode if (type) {efree(type);} if (ns) {efree(ns);} } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: restriction has no 'base' attribute"); + soap_error0(E_ERROR, "Parsing Schema: restriction has no 'base' attribute"); } trav = restType->children; @@ -780,12 +780,12 @@ static int schema_restriction_complexContent(sdlPtr sdl, xmlAttrPtr tns, xmlNode trav = trav->next; break; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in restriction", trav->name); } trav = trav->next; } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in restriction",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in restriction", trav->name); } return TRUE; @@ -810,7 +810,7 @@ static int schema_restriction_var_int(xmlNodePtr val, sdlRestrictionIntPtr *valp value = get_attribute(val->properties, "value"); if (value == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: missing restriction value"); + soap_error0(E_ERROR, "Parsing Schema: missing restriction value"); } (*valptr)->value = atoi(value->children->content); @@ -838,7 +838,7 @@ static int schema_restriction_var_char(xmlNodePtr val, sdlRestrictionCharPtr *va value = get_attribute(val->properties, "value"); if (value == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: missing restriction value"); + soap_error0(E_ERROR, "Parsing Schema: missing restriction value"); } (*valptr)->value = estrdup(value->children->content); @@ -872,7 +872,7 @@ static int schema_extension_simpleContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr if (type) {efree(type);} if (ns) {efree(ns);} } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: extension has no 'base' attribute"); + soap_error0(E_ERROR, "Parsing Schema: extension has no 'base' attribute"); } trav = extType->children; @@ -890,12 +890,12 @@ static int schema_extension_simpleContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr trav = trav->next; break; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in extension", trav->name); } trav = trav->next; } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in extension", trav->name); } return TRUE; } @@ -927,7 +927,7 @@ static int schema_extension_complexContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodePt if (type) {efree(type);} if (ns) {efree(ns);} } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: extension has no 'base' attribute"); + soap_error0(E_ERROR, "Parsing Schema: extension has no 'base' attribute"); } trav = extType->children; @@ -960,12 +960,12 @@ static int schema_extension_complexContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodePt trav = trav->next; break; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in extension", trav->name); } trav = trav->next; } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in extension",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in extension", trav->name); } return TRUE; } @@ -1021,7 +1021,7 @@ static int schema_all(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr all, sdlTypePtr cur if (node_is_equal(trav,"element")) { schema_element(sdl, tns, trav, cur_type, newModel); } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in all",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in all", trav->name); } trav = trav->next; } @@ -1101,7 +1101,7 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp zend_hash_init(sdl->groups, 0, NULL, delete_type, 0); } if (zend_hash_add(sdl->groups, key.c, key.len+1, (void**)&newType, sizeof(sdlTypePtr), NULL) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group '%s' already defined",key.c); + soap_error1(E_ERROR, "Parsing Schema: group '%s' already defined", key.c); } cur_type = newType; @@ -1114,7 +1114,7 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp zend_hash_next_index_insert(model->u.content, &newModel, sizeof(sdlContentModelPtr), NULL); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has no 'name' nor 'ref' attributes"); + soap_error0(E_ERROR, "Parsing Schema: group has no 'name' nor 'ref' attributes"); } newModel->min_occurs = 1; @@ -1142,31 +1142,31 @@ static int schema_group(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr groupType, sdlTyp if (trav != NULL) { if (node_is_equal(trav,"choice")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has both 'ref' attribute and subcontent"); + soap_error0(E_ERROR, "Parsing Schema: group has both 'ref' attribute and subcontent"); } newModel->kind = XSD_CONTENT_CHOICE; schema_choice(sdl, tns, trav, cur_type, newModel); trav = trav->next; } else if (node_is_equal(trav,"sequence")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has both 'ref' attribute and subcontent"); + soap_error0(E_ERROR, "Parsing Schema: group has both 'ref' attribute and subcontent"); } newModel->kind = XSD_CONTENT_SEQUENCE; schema_sequence(sdl, tns, trav, cur_type, newModel); trav = trav->next; } else if (node_is_equal(trav,"all")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: group has both 'ref' attribute and subcontent"); + soap_error0(E_ERROR, "Parsing Schema: group has both 'ref' attribute and subcontent"); } newModel->kind = XSD_CONTENT_ALL; schema_all(sdl, tns, trav, cur_type, newModel); trav = trav->next; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in group",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in group", trav->name); } } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in group",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in group", trav->name); } return TRUE; } @@ -1229,7 +1229,7 @@ static int schema_choice(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr choiceType, sdlT } else if (node_is_equal(trav,"any")) { schema_any(sdl, tns, trav, cur_type, newModel); } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in choice",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in choice", trav->name); } trav = trav->next; } @@ -1295,7 +1295,7 @@ static int schema_sequence(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr seqType, sdlTy } else if (node_is_equal(trav,"any")) { schema_any(sdl, tns, trav, cur_type, newModel); } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in sequence",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in sequence", trav->name); } trav = trav->next; } @@ -1335,13 +1335,13 @@ static int schema_complexContent(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compCont schema_extension_complexContent(sdl, tns, trav, cur_type); trav = trav->next; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexContent",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in complexContent", trav->name); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: <restriction> or <extension> expected in complexContent"); + soap_error0(E_ERROR, "Parsing Schema: <restriction> or <extension> expected in complexContent"); } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexContent", trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in complexContent", trav->name); } return TRUE; @@ -1418,7 +1418,7 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, s cur_type = (*ptr); create_encoder(sdl, cur_type, ns->children->content, name->children->content); } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: complexType has no 'name' attribute"); + soap_error0(E_ERROR, "Parsing Schema: complexType has no 'name' attribute"); return FALSE; } @@ -1458,14 +1458,14 @@ static int schema_complexType(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr compType, s trav = trav->next; break; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexType",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in complexType", trav->name); } trav = trav->next; } } } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in complexType",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in complexType", trav->name); } return TRUE; } @@ -1560,7 +1560,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp smart_str_0(&key); if (zend_hash_add(addHash, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) { if (cur_type == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element '%s' already defined",key.c); + soap_error1(E_ERROR, "Parsing Schema: element '%s' already defined", key.c); } else { zend_hash_next_index_insert(addHash, &newType, sizeof(sdlTypePtr), NULL); } @@ -1593,7 +1593,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp } cur_type = newType; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has no 'name' nor 'ref' attributes"); + soap_error0(E_ERROR, "Parsing Schema: element has no 'name' nor 'ref' attributes"); } /* nillable = boolean : false */ @@ -1601,7 +1601,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp attr = get_attribute(attrs, "nillable"); if (attr) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'nillable' attributes"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'ref' and 'nillable' attributes"); } if (!stricmp(attr->children->content, "true") || !stricmp(attr->children->content, "1")) { @@ -1616,7 +1616,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp attr = get_attribute(attrs, "fixed"); if (attr) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'fixed' attributes"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'ref' and 'fixed' attributes"); } cur_type->fixed = estrdup(attr->children->content); } @@ -1624,9 +1624,9 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp attr = get_attribute(attrs, "default"); if (attr) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'fixed' attributes"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'ref' and 'fixed' attributes"); } else if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'default' and 'fixed' attributes"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'default' and 'fixed' attributes"); } cur_type->def = estrdup(attr->children->content); } @@ -1638,7 +1638,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp xmlNsPtr nsptr; if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' and 'type' attributes"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'ref' and 'type' attributes"); } parse_namespace(type->children->content, &cptype, &str_ns); nsptr = xmlSearchNs(element->doc, element, str_ns); @@ -1657,17 +1657,17 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp if (trav != NULL) { if (node_is_equal(trav,"simpleType")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' attribute and subtype"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'ref' attribute and subtype"); } else if (type != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'type' attribute and subtype"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'type' attribute and subtype"); } schema_simpleType(sdl, tns, trav, cur_type); trav = trav->next; } else if (node_is_equal(trav,"complexType")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'ref' attribute and subtype"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'ref' attribute and subtype"); } else if (type != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: element has both 'type' attribute and subtype"); + soap_error0(E_ERROR, "Parsing Schema: element has both 'type' attribute and subtype"); } schema_complexType(sdl, tns, trav, cur_type); trav = trav->next; @@ -1681,7 +1681,7 @@ static int schema_element(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr element, sdlTyp } else if (node_is_equal(trav,"keyref")) { /* TODO: <keyref> support */ } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in element",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in element", trav->name); } trav = trav->next; } @@ -1761,11 +1761,11 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl } if (zend_hash_add(addHash, key.c, key.len + 1, &newAttr, sizeof(sdlAttributePtr), NULL) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute '%s' already defined", key.c); + soap_error1(E_ERROR, "Parsing Schema: attribute '%s' already defined", key.c); } smart_str_free(&key); } else{ - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has no 'name' nor 'ref' attributes"); + soap_error0(E_ERROR, "Parsing Schema: attribute has no 'name' nor 'ref' attributes"); } /* type = QName */ @@ -1775,7 +1775,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl xmlNsPtr nsptr; if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'ref' and 'type' attributes"); + soap_error0(E_ERROR, "Parsing Schema: attribute has both 'ref' and 'type' attributes"); } parse_namespace(type->children->content, &cptype, &str_ns); nsptr = xmlSearchNs(attrType->doc, attrType, str_ns); @@ -1865,9 +1865,9 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl if (node_is_equal(trav,"simpleType")) { sdlTypePtr dummy_type; if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'ref' attribute and subtype"); + soap_error0(E_ERROR, "Parsing Schema: attribute has both 'ref' attribute and subtype"); } else if (type != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attribute has both 'type' attribute and subtype"); + soap_error0(E_ERROR, "Parsing Schema: attribute has both 'type' attribute and subtype"); } dummy_type = emalloc(sizeof(sdlType)); memset(dummy_type, 0, sizeof(sdlType)); @@ -1880,7 +1880,7 @@ static int schema_attribute(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrType, sdl } } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in attribute",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in attribute", trav->name); } return TRUE; } @@ -1916,7 +1916,7 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrGrou smart_str_0(&key); if (zend_hash_add(ctx->attributeGroups, key.c, key.len + 1, &newType, sizeof(sdlTypePtr), NULL) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup '%s' already defined", key.c); + soap_error1(E_ERROR, "Parsing Schema: attributeGroup '%s' already defined", key.c); } cur_type = newType; smart_str_free(&key); @@ -1950,7 +1950,7 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrGrou cur_type = NULL; } } else{ - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has no 'name' nor 'ref' attributes"); + soap_error0(E_ERROR, "Parsing Schema: attributeGroup has no 'name' nor 'ref' attributes"); } trav = attrGroup->children; @@ -1961,28 +1961,28 @@ static int schema_attributeGroup(sdlPtr sdl, xmlAttrPtr tns, xmlNodePtr attrGrou while (trav != NULL) { if (node_is_equal(trav,"attribute")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute"); + soap_error0(E_ERROR, "Parsing Schema: attributeGroup has both 'ref' attribute and subattribute"); } schema_attribute(sdl, tns, trav, cur_type, NULL); } else if (node_is_equal(trav,"attributeGroup")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute"); + soap_error0(E_ERROR, "Parsing Schema: attributeGroup has both 'ref' attribute and subattribute"); } schema_attributeGroup(sdl, tns, trav, cur_type, NULL); } else if (node_is_equal(trav,"anyAttribute")) { if (ref != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: attributeGroup has both 'ref' attribute and subattribute"); + soap_error0(E_ERROR, "Parsing Schema: attributeGroup has both 'ref' attribute and subattribute"); } /* TODO: <anyAttribute> support */ trav = trav->next; break; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in attributeGroup",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in attributeGroup", trav->name); } trav = trav->next; } if (trav != NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unexpected <%s> in attributeGroup",trav->name); + soap_error1(E_ERROR, "Parsing Schema: unexpected <%s> in attributeGroup", trav->name); } return TRUE; } @@ -2112,7 +2112,7 @@ static void schema_content_model_fixup(sdlCtx *ctx, sdlContentModelPtr model) model->kind = XSD_CONTENT_GROUP; model->u.group = (*tmp); } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unresolved group 'ref' attribute"); + soap_error0(E_ERROR, "Parsing Schema: unresolved group 'ref' attribute"); } break; } @@ -2153,7 +2153,7 @@ static void schema_type_fixup(sdlCtx *ctx, sdlTypePtr type) type->def = estrdup((*tmp)->def); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing Schema: unresolved element 'ref' attribute"); + soap_error0(E_ERROR, "Parsing Schema: unresolved element 'ref' attribute"); } } efree(type->ref); diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c index 51161c327f..4fae9f6142 100644 --- a/ext/soap/php_sdl.c +++ b/ext/soap/php_sdl.c @@ -188,7 +188,7 @@ static int is_wsdl_element(xmlNodePtr node) attr->children && attr->children->content && (strcmp(attr->children->content,"1") == 0 || strcmp(attr->children->content,"true") == 0)) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unknown required WSDL extension '%s'", node->ns->href); + soap_error1(E_ERROR, "Parsing WSDL: Unknown required WSDL extension '%s'", node->ns->href); } return 0; } @@ -209,7 +209,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include) wsdl = soap_xmlParseFile(struri); if (!wsdl) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't load from '%s'", struri); + soap_error1(E_ERROR, "Parsing WSDL: Couldn't load from '%s'", struri); } zend_hash_add(&ctx->docs, struri, strlen(struri)+1, (void**)&wsdl, sizeof(xmlDocPtr), NULL); @@ -224,7 +224,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include) return; } } - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't find <definitions> in '%s'", struri); + soap_error1(E_ERROR, "Parsing WSDL: Couldn't find <definitions> in '%s'", struri); } if (!include) { @@ -248,7 +248,7 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include) if (node_is_equal_ex(trav2, "schema", XSD_NAMESPACE)) { load_schema(ctx, trav2); } else if (is_wsdl_element(trav2) && !node_is_equal(trav2,"documentation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav2->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name); } trav2 = trav2->next; } @@ -273,43 +273,43 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include) xmlAttrPtr name = get_attribute(trav->properties, "name"); if (name && name->children && name->children->content) { if (zend_hash_add(&ctx->messages, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <message> '%s' already defined",name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: <message> '%s' already defined", name->children->content); } } else { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <message> hasn't name attribute"); + soap_error0(E_ERROR, "Parsing WSDL: <message> hasn't name attribute"); } } else if (node_is_equal(trav,"portType")) { xmlAttrPtr name = get_attribute(trav->properties, "name"); if (name && name->children && name->children->content) { if (zend_hash_add(&ctx->portTypes, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <portType> '%s' already defined",name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: <portType> '%s' already defined", name->children->content); } } else { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <portType> hasn't name attribute"); + soap_error0(E_ERROR, "Parsing WSDL: <portType> hasn't name attribute"); } } else if (node_is_equal(trav,"binding")) { xmlAttrPtr name = get_attribute(trav->properties, "name"); if (name && name->children && name->children->content) { if (zend_hash_add(&ctx->bindings, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <binding> '%s' already defined",name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: <binding> '%s' already defined", name->children->content); } } else { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <binding> hasn't name attribute"); + soap_error0(E_ERROR, "Parsing WSDL: <binding> hasn't name attribute"); } } else if (node_is_equal(trav,"service")) { xmlAttrPtr name = get_attribute(trav->properties, "name"); if (name && name->children && name->children->content) { if (zend_hash_add(&ctx->services, name->children->content, strlen(name->children->content)+1,&trav, sizeof(xmlNodePtr), NULL) != SUCCESS) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <service> '%s' already defined",name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: <service> '%s' already defined", name->children->content); } } else { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: <service> hasn't name attribute"); + soap_error0(E_ERROR, "Parsing WSDL: <service> hasn't name attribute"); } } else if (!node_is_equal(trav,"documentation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); } trav = trav->next; } @@ -324,7 +324,7 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml tmp = get_attribute(header->properties, "message"); if (!tmp) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing message attribute for <header>"); + soap_error0(E_ERROR, "Parsing WSDL: Missing message attribute for <header>"); } ctype = strrchr(tmp->children->content,':'); @@ -334,16 +334,16 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml ++ctype; } if (zend_hash_find(&ctx->messages, ctype, strlen(ctype)+1, (void**)&message) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <message> with name '%s'", tmp->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing <message> with name '%s'", tmp->children->content); } tmp = get_attribute(header->properties, "part"); if (!tmp) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing part attribute for <header>"); + soap_error0(E_ERROR, "Parsing WSDL: Missing part attribute for <header>"); } part = get_node_with_attribute_ex((*message)->children, "part", WSDL_NAMESPACE, "name", tmp->children->content, NULL); if (!part) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing part '%s' in <message>",tmp->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing part '%s' in <message>", tmp->children->content); } h = emalloc(sizeof(sdlSoapBindingFunctionHeader)); @@ -370,10 +370,10 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml } else if (strncmp(tmp->children->content,SOAP_1_2_ENC_NAMESPACE,sizeof(SOAP_1_2_ENC_NAMESPACE)) == 0) { h->encodingStyle = SOAP_ENCODING_1_2; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unknown encodingStyle '%s'",tmp->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Unknown encodingStyle '%s'", tmp->children->content); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle"); + soap_error0(E_ERROR, "Parsing WSDL: Unspecified encodingStyle"); } } @@ -415,7 +415,7 @@ static sdlSoapBindingFunctionHeaderPtr wsdl_soap_binding_header(sdlCtx* ctx, xml } smart_str_free(&key); } else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); } trav = trav->next; } @@ -459,10 +459,10 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap } else if (strncmp(tmp->children->content,SOAP_1_2_ENC_NAMESPACE,sizeof(SOAP_1_2_ENC_NAMESPACE)) == 0) { binding->encodingStyle = SOAP_ENCODING_1_2; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unknown encodingStyle '%s'",tmp->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Unknown encodingStyle '%s'", tmp->children->content); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle"); + soap_error0(E_ERROR, "Parsing WSDL: Unspecified encodingStyle"); } } } else if (node_is_equal_ex(trav, "header", wsdl_soap_namespace)) { @@ -485,7 +485,7 @@ static void wsdl_soap_binding_body(sdlCtx* ctx, xmlNodePtr node, char* wsdl_soap } smart_str_free(&key); } else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); } trav = trav->next; } @@ -504,7 +504,7 @@ static HashTable* wsdl_message(sdlCtx *ctx, char* message_name) ++ctype; } if (zend_hash_find(&ctx->messages, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <message> with name '%s'", message_name); + soap_error1(E_ERROR, "Parsing WSDL: Missing <message> with name '%s'", message_name); } message = *tmp; @@ -517,14 +517,14 @@ static HashTable* wsdl_message(sdlCtx *ctx, char* message_name) sdlParamPtr param; if (trav->ns != NULL && strcmp(trav->ns->href,WSDL_NAMESPACE) != 0) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected extensibility element <%s>",trav->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected extensibility element <%s>", trav->name); } if (node_is_equal(trav,"documentation")) { trav = trav->next; continue; } if (!node_is_equal(trav,"part")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); } part = trav; param = emalloc(sizeof(sdlParam)); @@ -533,7 +533,7 @@ static HashTable* wsdl_message(sdlCtx *ctx, char* message_name) name = get_attribute(part->properties, "name"); if (name == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No name associated with <part> '%s'", message->name); + soap_error1(E_ERROR, "Parsing WSDL: No name associated with <part> '%s'", message->name); } param->paramName = estrdup(name->children->content); @@ -602,7 +602,7 @@ static sdlPtr load_wsdl(char *struri) continue; } if (!node_is_equal(trav,"port")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); } port = trav; @@ -612,7 +612,7 @@ static sdlPtr load_wsdl(char *struri) bindingAttr = get_attribute(port->properties, "binding"); if (bindingAttr == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No binding associated with <port>"); + soap_error0(E_ERROR, "Parsing WSDL: No binding associated with <port>"); } /* find address and figure out binding type */ @@ -641,17 +641,17 @@ static sdlPtr load_wsdl(char *struri) } } if (trav2 != address && is_wsdl_element(trav2) && !node_is_equal(trav2,"documentation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav2->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name); } trav2 = trav2->next; } if (!address) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No address associated with <port>"); + soap_error0(E_ERROR, "Parsing WSDL: No address associated with <port>"); } location = get_attribute(address->properties, "location"); if (!location) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No location associated with <port>"); + soap_error0(E_ERROR, "Parsing WSDL: No location associated with <port>"); } tmpbinding->location = estrdup(location->children->content); @@ -663,7 +663,7 @@ static sdlPtr load_wsdl(char *struri) ++ctype; } if (zend_hash_find(&ctx.bindings, ctype, strlen(ctype)+1, (void*)&tmp) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: No <binding> element with name '%s'", ctype); + soap_error1(E_ERROR, "Parsing WSDL: No <binding> element with name '%s'", ctype); } binding = *tmp; @@ -688,7 +688,7 @@ static sdlPtr load_wsdl(char *struri) if (strncmp(tmp->children->content, WSDL_HTTP_TRANSPORT, sizeof(WSDL_HTTP_TRANSPORT)) == 0) { soapBinding->transport = SOAP_TRANSPORT_HTTP; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: PHP-SOAP doesn't support transport '%s'", tmp->children->content); + soap_error1(E_ERROR, "Parsing WSDL: PHP-SOAP doesn't support transport '%s'", tmp->children->content); } } } @@ -697,13 +697,13 @@ static sdlPtr load_wsdl(char *struri) name = get_attribute(binding->properties, "name"); if (name == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'name' attribute for <binding>"); + soap_error0(E_ERROR, "Parsing WSDL: Missing 'name' attribute for <binding>"); } tmpbinding->name = estrdup(name->children->content); type = get_attribute(binding->properties, "type"); if (type == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'type' attribute for <binding>"); + soap_error0(E_ERROR, "Parsing WSDL: Missing 'type' attribute for <binding>"); } ctype = strrchr(type->children->content,':'); @@ -713,7 +713,7 @@ static sdlPtr load_wsdl(char *struri) ++ctype; } if (zend_hash_find(&ctx.portTypes, ctype, strlen(ctype)+1, (void**)&tmp) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <portType> with name '%s'", name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing <portType> with name '%s'", name->children->content); } portType = *tmp; @@ -731,14 +731,14 @@ static sdlPtr load_wsdl(char *struri) continue; } if (!node_is_equal(trav2,"operation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav2->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav2->name); } operation = trav2; op_name = get_attribute(operation->properties, "name"); if (op_name == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing 'name' attribute for <operation>"); + soap_error0(E_ERROR, "Parsing WSDL: Missing 'name' attribute for <operation>"); } trav3 = operation->children; @@ -750,14 +750,14 @@ static sdlPtr load_wsdl(char *struri) !node_is_equal(trav3,"output") && !node_is_equal(trav3,"fault") && !node_is_equal(trav3,"documentation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav3->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav3->name); } trav3 = trav3->next; } portTypeOperation = get_node_with_attribute_ex(portType->children, "operation", WSDL_NAMESPACE, "name", op_name->children->content, NULL); if (portTypeOperation == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing <portType>/<operation> with name '%s'", op_name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing <portType>/<operation> with name '%s'", op_name->children->content); } function = emalloc(sizeof(sdlFunction)); @@ -803,7 +803,7 @@ static sdlPtr load_wsdl(char *struri) message = get_attribute(input->properties, "message"); if (message == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing name for <input> of '%s'", op_name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing name for <input> of '%s'", op_name->children->content); } function->requestParameters = wsdl_message(&ctx, message->children->content); @@ -832,7 +832,7 @@ static sdlPtr load_wsdl(char *struri) message = get_attribute(output->properties, "message"); if (message == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing name for <output> of '%s'", op_name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing name for <output> of '%s'", op_name->children->content); } function->responseParameters = wsdl_message(&ctx, message->children->content); @@ -873,11 +873,11 @@ static sdlPtr load_wsdl(char *struri) name = get_attribute(fault->properties, "name"); if (name == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing name for <fault> of '%s'", op_name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing name for <fault> of '%s'", op_name->children->content); } message = get_attribute(fault->properties, "message"); if (message == NULL) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Missing name for <output> of '%s'", op_name->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Missing name for <output> of '%s'", op_name->children->content); } f = emalloc(sizeof(sdlFault)); @@ -886,7 +886,7 @@ static sdlPtr load_wsdl(char *struri) f->name = estrdup(name->children->content); f->details = wsdl_message(&ctx, message->children->content); if (f->details == NULL || zend_hash_num_elements(f->details) > 1) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: The fault message '%s' must have a single part", message->children->content); + soap_error1(E_ERROR, "Parsing WSDL: The fault message '%s' must have a single part", message->children->content); } if (tmpbinding->bindingType == BINDING_SOAP) { @@ -921,14 +921,14 @@ static sdlPtr load_wsdl(char *struri) } else if (strncmp(tmp->children->content,SOAP_1_2_ENC_NAMESPACE,sizeof(SOAP_1_2_ENC_NAMESPACE)) == 0) { binding->encodingStyle = SOAP_ENCODING_1_2; } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unknown encodingStyle '%s'",tmp->children->content); + soap_error1(E_ERROR, "Parsing WSDL: Unknown encodingStyle '%s'", tmp->children->content); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Unspecified encodingStyle"); + soap_error0(E_ERROR, "Parsing WSDL: Unspecified encodingStyle"); } } } else if (is_wsdl_element(trav) && !node_is_equal(trav,"documentation")) { - php_error(E_ERROR,"SOAP-ERROR: Parsing WSDL: Unexpected WSDL element <%s>",trav->name); + soap_error1(E_ERROR, "Parsing WSDL: Unexpected WSDL element <%s>", trav->name); } trav = trav->next; } @@ -939,7 +939,7 @@ static sdlPtr load_wsdl(char *struri) zend_hash_init(function->faults, 0, NULL, delete_fault, 0); } if (zend_hash_add(function->faults, f->name, strlen(f->name)+1, (void**)&f, sizeof(sdlFaultPtr), NULL) != SUCCESS) { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: <fault> with name '%s' already defined in '%s'", f->name, op_name->children->content); + soap_error2(E_ERROR, "Parsing WSDL: <fault> with name '%s' already defined in '%s'", f->name, op_name->children->content); } } fault = fault->next; @@ -981,7 +981,7 @@ static sdlPtr load_wsdl(char *struri) zend_hash_move_forward(&ctx.services); } } else { - php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't bind to service"); + soap_error0(E_ERROR, "Parsing WSDL: Couldn't bind to service"); } zend_hash_destroy(&ctx.messages); diff --git a/ext/soap/php_soap.h b/ext/soap/php_soap.h index 2eeba6be9f..dfe1af553e 100644 --- a/ext/soap/php_soap.h +++ b/ext/soap/php_soap.h @@ -185,4 +185,16 @@ extern zend_class_entry* soap_var_class_entry; zval* add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail TSRMLS_DC); +#define soap_error0(severity, format) \ + php_error(severity, "SOAP-ERROR: " format) + +#define soap_error1(severity, format, param1) \ + php_error(severity, "SOAP-ERROR: " format, param1) + +#define soap_error2(severity, format, param1, param2) \ + php_error(severity, "SOAP-ERROR: " format, param1, param2) + +#define soap_error3(severity, format, param1, param2, param3) \ + php_error(severity, "SOAP-ERROR: " format, param1, param2, param3) + #endif diff --git a/ext/soap/soap.c b/ext/soap/soap.c index d3a477314b..158544a56a 100644 --- a/ext/soap/soap.c +++ b/ext/soap/soap.c @@ -593,7 +593,7 @@ PHP_FUNCTION(soap_encode_to_xml) int found, name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sz", &name, &name_len, &pzval) == FAILURE) { - php_error(E_ERROR, "wrong number of parameters to soap_encode_to_xml"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "wrong number of parameters"); } enc = get_conversion(Z_TYPE_P(pzval)); @@ -609,7 +609,7 @@ PHP_FUNCTION(soap_encode_to_zval) xmlNodePtr node; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &dom) == FAILURE) { - php_error(E_ERROR, "wrong number of parameters to soap_encode_to_zval"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "wrong number of parameters"); } if (zend_hash_index_find(Z_OBJPROP_P(dom), 1, (void **)&addr) == FAILURE) { @@ -629,7 +629,7 @@ PHP_METHOD(SoapParam, SoapParam) int name_length; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &data, &name, &name_length) == FAILURE) { - php_error(E_ERROR, "Invalid arguments to SoapParam constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } #ifndef ZEND_ENGINE_2 @@ -648,7 +648,7 @@ PHP_METHOD(SoapHeader, SoapHeader) zend_bool must_understand = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|zbz", &ns, &ns_len, &name, &name_len, &data, &must_understand, &actor) == FAILURE) { - php_error(E_ERROR, "Invalid arguments to SoapHeader constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } add_property_stringl(this_ptr, "namespace", ns, ns_len, 1); @@ -666,7 +666,7 @@ PHP_METHOD(SoapHeader, SoapHeader) } else if (Z_TYPE_P(actor) == IS_STRING) { add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor), 1); } else { - php_error(E_ERROR, "Invalid arguments to SoapHeader constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } } @@ -682,7 +682,7 @@ PHP_METHOD(SoapFault, SoapFault) &fault_string, &fault_string_len, &fault_actor, &fault_actor_len, &details, &name, &name_len, &headerfault) == FAILURE) { - php_error(E_ERROR, "Invalid arguments to SoapFault constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } set_soap_fault(this_ptr, fault_code, fault_string, fault_actor, details, name TSRMLS_CC); @@ -737,7 +737,7 @@ PHP_METHOD(SoapVar, SoapVar) int stype_len, ns_len, name_len, namens_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z!z|ssss", &data, &type, &stype, &stype_len, &ns, &ns_len, &name, &name_len, &namens, &namens_len) == FAILURE) { - php_error(E_ERROR, "Invalid arguments to SoapVar constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } if (Z_TYPE_P(type) == IS_NULL) { @@ -746,7 +746,7 @@ PHP_METHOD(SoapVar, SoapVar) if (zend_hash_index_exists(&SOAP_GLOBAL(defEncIndex), Z_LVAL_P(type))) { add_property_long(this_ptr, "enc_type", Z_LVAL_P(type)); } else { - php_error(E_ERROR, "Invalid type ID to SoapVar constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid type ID"); } } @@ -782,14 +782,14 @@ PHP_METHOD(SoapServer, SoapServer) SOAP_SERVER_BEGIN_CODE(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) { - php_error(E_ERROR, "Invalid arguments to SoapServer constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } if (Z_TYPE_P(wsdl) == IS_STRING) { } else if (Z_TYPE_P(wsdl) == IS_NULL) { wsdl = NULL; } else { - php_error(E_ERROR, "Invalid arguments to SoapServer constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } service = emalloc(sizeof(soapService)); @@ -810,7 +810,7 @@ PHP_METHOD(SoapServer, SoapServer) Z_TYPE_PP(tmp) == IS_STRING) { service->uri = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } else if (wsdl == NULL) { - php_error(E_ERROR, "Invalid arguments to SoapServer constructor. 'uri' option is required in nonWSDL mode."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is required in nonWSDL mode."); return; } @@ -819,7 +819,7 @@ PHP_METHOD(SoapServer, SoapServer) service->actor = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp)); } } else if (wsdl == NULL) { - php_error(E_ERROR, "Invalid arguments to SoapServer constructor. 'uri' option is required in nonWSDL mode."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is required in nonWSDL mode."); } service->version = version; @@ -962,7 +962,7 @@ PHP_FUNCTION(PHP_SOAP_SERVER_CLASS, map) smart_str_free(&resloved_ns); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "ss|l", &type, &type_len, &class_name, &class_name_len, &type) == SUCCESS) { } else { - php_error(E_ERROR, "Wrong number of parameters to SoapServer->map"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrong number of parameters"); } } #endif @@ -982,10 +982,10 @@ PHP_METHOD(SoapServer, setPersistence) value == SOAP_PERSISTENCE_REQUEST) { service->soap_class.persistance = value; } else { - php_error(E_ERROR, "Tried to set persistence with bogus value (%ld)", value); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to set persistence with bogus value (%ld)", value); } } else { - php_error(E_ERROR, "Tried to set persistence when you are using you SOAP SERVER in function mode, no persistence needed"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to set persistence when you are using you SOAP SERVER in function mode, no persistence needed"); } } @@ -1035,10 +1035,10 @@ PHP_METHOD(SoapServer, setClass) } } } else { - php_error(E_ERROR, "Tried to set a non existant class (%s)", Z_STRVAL_PP(argv[0])); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to set a non existant class (%s)", Z_STRVAL_PP(argv[0])); } } else { - php_error(E_ERROR, "You must pass in a string to setclass"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "You must pass in a string"); } efree(argv); @@ -1095,7 +1095,7 @@ PHP_METHOD(SoapServer, addFunction) FETCH_THIS_SERVICE(service); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &function_name) == FAILURE) { - php_error(E_ERROR, "Invalid parameters passed to addfunction"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters passed"); } /* TODO: could use zend_is_callable here */ @@ -1117,7 +1117,7 @@ PHP_METHOD(SoapServer, addFunction) zend_function *f; if (Z_TYPE_PP(tmp_function) != IS_STRING) { - php_error(E_ERROR, "Tried to add a function that isn't a string"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to add a function that isn't a string"); } key_len = Z_STRLEN_PP(tmp_function); @@ -1125,7 +1125,7 @@ PHP_METHOD(SoapServer, addFunction) zend_str_tolower_copy(key, Z_STRVAL_PP(tmp_function), key_len); if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) { - php_error(E_ERROR, "Tried to add a non existant function '%s'", Z_STRVAL_PP(tmp_function)); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to add a non existant function '%s'", Z_STRVAL_PP(tmp_function)); } MAKE_STD_ZVAL(function_copy); @@ -1146,7 +1146,7 @@ PHP_METHOD(SoapServer, addFunction) zend_str_tolower_copy(key, Z_STRVAL_P(function_name), key_len); if (zend_hash_find(EG(function_table), key, key_len+1, (void**)&f) == FAILURE) { - php_error(E_ERROR, "Tried to add a non existant function '%s'", Z_STRVAL_P(function_name)); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to add a non existant function '%s'", Z_STRVAL_P(function_name)); } if (service->soap_functions.ft == NULL) { service->soap_functions.functions_all = FALSE; @@ -1167,7 +1167,7 @@ PHP_METHOD(SoapServer, addFunction) } service->soap_functions.functions_all = TRUE; } else { - php_error(E_ERROR, "Invalid value passed to addfunction"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid value passed"); } } @@ -1195,7 +1195,7 @@ PHP_METHOD(SoapServer, handle) FETCH_THIS_SERVICE(service); SOAP_GLOBAL(soap_version) = service->version; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &arg, &arg_len) == FAILURE) { - php_error(E_ERROR, "Invalid parameters passed to soapserver:handle"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters passed"); } INIT_ZVAL(retval); @@ -1222,7 +1222,7 @@ PHP_METHOD(SoapServer, handle) ZVAL_STRING(param, service->sdl->source, 1); ZVAL_STRING(&readfile, "readfile", 1); if (call_user_function(EG(function_table), NULL, &readfile, &readfile_ret, 1, ¶m TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "Couldn't find WSDL"); + soap_server_fault("Server", "Couldn't find WSDL", NULL, NULL, NULL TSRMLS_CC); } zval_ptr_dtor(¶m); @@ -1232,7 +1232,7 @@ PHP_METHOD(SoapServer, handle) SOAP_SERVER_END_CODE(); return; } else { - php_error(E_ERROR, "WSDL generation is not supported yet"); + soap_server_fault("Server", "WSDL generation is not supported yet", NULL, NULL, NULL TSRMLS_CC); /* sapi_add_header("Content-Type: text/xml; charset=\"utf-8\"", sizeof("Content-Type: text/xml; charset=\"utf-8\""), 1); PUTS("<?xml version=\"1.0\" ?>\n<definitions\n"); @@ -1251,7 +1251,7 @@ PHP_METHOD(SoapServer, handle) } if (php_start_ob_buffer(NULL, 0, 0 TSRMLS_CC) != SUCCESS) { - php_error(E_ERROR,"ob_start failed"); + php_error_docref(NULL TSRMLS_CC, E_ERROR,"ob_start failed"); } if (ZEND_NUM_ARGS() == 0) { @@ -1282,14 +1282,14 @@ PHP_METHOD(SoapServer, handle) ZVAL_STRINGL(params[0], Z_STRVAL_PP(raw_post), Z_STRLEN_PP(raw_post), 0); INIT_PZVAL(params[0]); } else { - php_error(E_ERROR,"Request is compressed with unknown compression '%s'",Z_STRVAL_PP(encoding)); + php_error_docref(NULL TSRMLS_CC, E_ERROR,"Request is compressed with unknown compression '%s'",Z_STRVAL_PP(encoding)); } if (call_user_function(CG(function_table), (zval**)NULL, &func, &retval, 1, params TSRMLS_CC) == SUCCESS && Z_TYPE(retval) == IS_STRING) { doc_request = soap_xmlParseMemory(Z_STRVAL(retval),Z_STRLEN(retval)); zval_dtor(&retval); } else { - php_error(E_ERROR,"Can't uncompress compressed request"); + php_error_docref(NULL TSRMLS_CC, E_ERROR,"Can't uncompress compressed request"); } } else { doc_request = soap_xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post)); @@ -1300,20 +1300,20 @@ PHP_METHOD(SoapServer, handle) if (zend_hash_find(Z_ARRVAL_PP(server_vars), "REQUEST_METHOD", sizeof("REQUEST_METHOD"), (void **)&req_method) == SUCCESS) { if (!strcmp(Z_STRVAL_PP(req_method), "POST")) { if (!zend_ini_long("always_populate_raw_post_data", sizeof("always_populate_raw_post_data"), 0)) { - php_error(E_ERROR, "PHP-SOAP requires 'always_populate_raw_post_data' to be on please check your php.ini file"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "PHP-SOAP requires 'always_populate_raw_post_data' to be on please check your php.ini file"); } } } } - php_error(E_ERROR, "Bad Request. Can't find HTTP_RAW_POST_DATA"); + soap_server_fault("Server", "Bad Request. Can't find HTTP_RAW_POST_DATA", NULL, NULL, NULL TSRMLS_CC); return; } } else { doc_request = soap_xmlParseMemory(arg,arg_len); } - if (doc_request == NULL) { - php_error(E_ERROR, "Bad Request"); + if (doc_request == NULL) { + soap_server_fault("Client", "Bad Request", NULL, NULL, NULL TSRMLS_CC); } if (xmlGetIntSubset(doc_request) != NULL) { xmlNodePtr env = get_node(doc_request->children,"Envelope"); @@ -1325,7 +1325,7 @@ PHP_METHOD(SoapServer, handle) } } xmlFreeDoc(doc_request); - php_error(E_ERROR,"DTD are not supported by SOAP"); + soap_server_fault("Server", "DTD are not supported by SOAP", NULL, NULL, NULL TSRMLS_CC); } old_sdl = SOAP_GLOBAL(sdl); @@ -1371,7 +1371,7 @@ PHP_METHOD(SoapServer, handle) ZVAL_STRING(&constructor, ZEND_CONSTRUCTOR_FUNC_NAME, 1); if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "Error calling constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor"); } if (EG(exception)) { if (Z_TYPE_P(EG(exception)) == IS_OBJECT && @@ -1403,7 +1403,7 @@ PHP_METHOD(SoapServer, handle) ZVAL_STRING(&constructor, service->soap_class.ce->name, 1); if (call_user_function(NULL, &tmp_soap, &constructor, &c_ret, service->soap_class.argc, service->soap_class.argv TSRMLS_CC) == FAILURE) { - php_error(E_ERROR, "Error calling constructor"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error calling constructor"); } #ifdef ZEND_ENGINE_2 if (EG(exception)) { @@ -1475,7 +1475,7 @@ PHP_METHOD(SoapServer, handle) call_status = call_user_function(EG(function_table), NULL, &h->function_name, &h->retval, h->num_params, h->parameters TSRMLS_CC); } if (call_status != SUCCESS) { - php_error(E_ERROR, "Function '%s' call failed", Z_STRVAL(h->function_name)); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Function '%s' call failed", Z_STRVAL(h->function_name)); } if (Z_TYPE(h->retval) == IS_OBJECT && Z_OBJCE(h->retval) == soap_fault_class_entry) { @@ -1563,7 +1563,7 @@ PHP_METHOD(SoapServer, handle) SOAP_GLOBAL(overrides) = NULL; efree(response_name); } else { - php_error(E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name)); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name)); } /* Flush buffer */ @@ -1573,7 +1573,7 @@ PHP_METHOD(SoapServer, handle) xmlDocDumpMemory(doc_return, &buf, &size); if (size == 0) { - php_error(E_ERROR, "Dump memory failed"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Dump memory failed"); } sprintf(cont_len, "Content-Length: %d", size); @@ -1632,7 +1632,7 @@ PHP_METHOD(SoapServer, fault) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "ss|szs", &code, &code_len, &string, &string_len, &actor, &actor_len, &details, &name, &name_len) == FAILURE) { - php_error(E_ERROR, "Invalid parameters passed to soapserver:fault"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters"); } soap_server_fault(code, string, actor, details, name TSRMLS_CC); @@ -1788,13 +1788,13 @@ PHP_METHOD(SoapClient, SoapClient) SOAP_CLIENT_BEGIN_CODE(); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) { - php_error(E_ERROR, "Can't create SoapClient. Invalid parameters."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters."); return; } if (Z_TYPE_P(wsdl) == IS_STRING) { } else if (Z_TYPE_P(wsdl) != IS_NULL ) { - php_error(E_ERROR, "Can't create SoapClient. $wsdl must be string or null."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "$wsdl must be string or null."); return; } else { wsdl = NULL; @@ -1809,7 +1809,7 @@ PHP_METHOD(SoapClient, SoapClient) Z_TYPE_PP(tmp) == IS_STRING) { add_property_stringl(this_ptr, "location", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); } else { - php_error(E_ERROR, "Can't create SoapClient. 'location' option is requred in nonWSDL mode."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' option is requred in nonWSDL mode."); return; } @@ -1817,7 +1817,7 @@ PHP_METHOD(SoapClient, SoapClient) Z_TYPE_PP(tmp) == IS_STRING) { add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1); } else { - php_error(E_ERROR, "Can't create SoapClient. 'uri' option is requred in nonWSDL mode."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is requred in nonWSDL mode."); return; } @@ -1886,7 +1886,7 @@ PHP_METHOD(SoapClient, SoapClient) add_property_long(this_ptr, "compression", Z_LVAL_PP(tmp)); } } else if (wsdl == NULL) { - php_error(E_ERROR, "Can't create SoapClient. 'location' and 'uri' options are requred in nonWSDL mode."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are requred in nonWSDL mode."); return; } @@ -2077,7 +2077,7 @@ PHP_METHOD(SoapClient, __call) if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|zzz", &function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) { - php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } if (options) { @@ -2095,7 +2095,7 @@ PHP_METHOD(SoapClient, __call) soap_action = Z_STRVAL_PP(tmp); } } else if (Z_TYPE_P(options) != IS_NULL) { - php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } } @@ -2108,7 +2108,7 @@ PHP_METHOD(SoapClient, __call) while (zend_hash_get_current_data(soap_headers, (void**)&tmp) == SUCCESS) { if (Z_TYPE_PP(tmp) != IS_OBJECT || Z_OBJCE_PP(tmp) != soap_header_class_entry) { - php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } zend_hash_move_forward(soap_headers); } @@ -2119,7 +2119,7 @@ PHP_METHOD(SoapClient, __call) zend_hash_next_index_insert(soap_headers, &headers, sizeof(zval*), NULL); headers = NULL; } else{ - php_error(E_ERROR, "Invalid arguments to SoapClient->__call"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments"); } arg_count = zend_hash_num_elements(Z_ARRVAL_P(args)); @@ -2391,7 +2391,8 @@ static void deserialize_parameters(xmlNodePtr params, sdlFunctionPtr function, i sdlParamPtr *param = NULL; if (function != NULL && zend_hash_index_find(function->requestParameters, cur_param, (void **)¶m) == FAILURE) { - php_error(E_ERROR, "Error cannot find parameter"); + TSRMLS_FETCH(); + soap_server_fault("Client", "Error cannot find parameter", NULL, NULL, NULL TSRMLS_CC); } if (param == NULL) { enc = NULL; @@ -2463,24 +2464,24 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c envelope_ns = SOAP_1_2_ENV_NAMESPACE; SOAP_GLOBAL(soap_version) = SOAP_1_2; } else { - soap_server_fault("VersionMismatch","Wrong Version", NULL, NULL, NULL TSRMLS_CC); + soap_server_fault("VersionMismatch", "Wrong Version", NULL, NULL, NULL TSRMLS_CC); } } trav = trav->next; } if (env == NULL) { - php_error(E_ERROR,"looks like we got XML without \"Envelope\" element"); + soap_server_fault("Client", "looks like we got XML without \"Envelope\" element", NULL, NULL, NULL TSRMLS_CC); } attr = env->properties; while (attr != NULL) { if (attr->ns == NULL) { - php_error(E_ERROR,"A SOAP Envelope element cannot have non Namespace qualified attributes"); + soap_server_fault("Client", "A SOAP Envelope element cannot have non Namespace qualified attributes", NULL, NULL, NULL TSRMLS_CC); } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) { if (*version == SOAP_1_2) { - php_error(E_ERROR,"encodingStyle cannot be specified on the Envelope"); + soap_server_fault("Client", "encodingStyle cannot be specified on the Envelope", NULL, NULL, NULL TSRMLS_CC); } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) { - php_error(E_ERROR,"Unknown data encoding style"); + soap_server_fault("Client", "Unknown data encoding style", NULL, NULL, NULL TSRMLS_CC); } } attr = attr->next; @@ -2510,26 +2511,26 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c trav = trav->next; } if (body == NULL) { - php_error(E_ERROR,"Body must be present in a SOAP envelope"); + soap_server_fault("Client", "Body must be present in a SOAP envelope", NULL, NULL, NULL TSRMLS_CC); } attr = body->properties; while (attr != NULL) { if (attr->ns == NULL) { if (*version == SOAP_1_2) { - php_error(E_ERROR,"A SOAP Body element cannot have non Namespace qualified attributes"); + soap_server_fault("Client", "A SOAP Body element cannot have non Namespace qualified attributes", NULL, NULL, NULL TSRMLS_CC); } } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) { if (*version == SOAP_1_2) { - php_error(E_ERROR,"encodingStyle cannot be specified on the Body"); + soap_server_fault("Client", "encodingStyle cannot be specified on the Body", NULL, NULL, NULL TSRMLS_CC); } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) { - php_error(E_ERROR,"Unknown data encoding style"); + soap_server_fault("Client", "Unknown data encoding style", NULL, NULL, NULL TSRMLS_CC); } } attr = attr->next; } if (trav != NULL && *version == SOAP_1_2) { - php_error(E_ERROR,"A SOAP 1.2 envelope can contain only Header and Body"); + soap_server_fault("Client", "A SOAP 1.2 envelope can contain only Header and Body", NULL, NULL, NULL TSRMLS_CC); } func = NULL; @@ -2537,7 +2538,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c while (trav != NULL) { if (trav->type == XML_ELEMENT_NODE) { if (func != NULL) { - php_error(E_ERROR,"looks like we got \"Body\" with several functions call"); + soap_server_fault("Client", "looks like we got \"Body\" with several functions call", NULL, NULL, NULL TSRMLS_CC); } func = trav; } @@ -2549,7 +2550,7 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c INIT_ZVAL(*function_name); ZVAL_STRING(function_name, (char *)function->functionName, 1); } else { - php_error(E_ERROR,"looks like we got \"Body\" without function call"); + soap_server_fault("Client", "looks like we got \"Body\" without function call", NULL, NULL, NULL TSRMLS_CC); } } else { if (*version == SOAP_1_1) { @@ -2580,12 +2581,12 @@ static sdlFunctionPtr deserialize_function_call(sdlPtr sdl, xmlDocPtr request, c attr = head->properties; while (attr != NULL) { if (attr->ns == NULL) { - php_error(E_ERROR,"A SOAP Header element cannot have non Namespace qualified attributes"); + soap_server_fault("Client", "A SOAP Header element cannot have non Namespace qualified attributes", NULL, NULL, NULL TSRMLS_CC); } else if (attr_is_equal_ex(attr,"encodingStyle",SOAP_1_2_ENV_NAMESPACE)) { if (*version == SOAP_1_2) { - php_error(E_ERROR,"encodingStyle cannot be specified on the Header"); + soap_server_fault("Client", "encodingStyle cannot be specified on the Header", NULL, NULL, NULL TSRMLS_CC); } else if (strcmp(attr->children->content,SOAP_1_1_ENC_NAMESPACE) != 0) { - php_error(E_ERROR,"Unknown data encoding style"); + soap_server_fault("Client", "Unknown data encoding style", NULL, NULL, NULL TSRMLS_CC); } } attr = attr->next; @@ -2821,7 +2822,7 @@ static xmlDocPtr serialize_response_call(sdlFunctionPtr function, char *function ns = xmlNewNs(envelope, SOAP_1_2_ENV_NAMESPACE, SOAP_1_2_ENV_NS_PREFIX); xmlSetNs(envelope,ns); } else { - php_error(E_ERROR, "Unknown SOAP version"); + soap_server_fault("Server", "Unknown SOAP version", NULL, NULL, NULL TSRMLS_CC); } xmlDocSetRootElement(doc, envelope); @@ -3135,7 +3136,7 @@ static xmlDocPtr serialize_function_call(zval *this_ptr, sdlFunctionPtr function ns = xmlNewNs(envelope, SOAP_1_2_ENV_NAMESPACE, SOAP_1_2_ENV_NS_PREFIX); xmlSetNs(envelope,ns); } else { - php_error(E_ERROR, "SOAP-ERROR: Unknown SOAP version"); + soap_error0(E_ERROR, "Unknown SOAP version"); } xmlDocSetRootElement(doc, envelope); diff --git a/ext/soap/tests/soap12/T28.phpt b/ext/soap/tests/soap12/T28.phpt index de6d756b8e..6118b478d8 100644 --- a/ext/soap/tests/soap12/T28.phpt +++ b/ext/soap/tests/soap12/T28.phpt @@ -18,5 +18,5 @@ include "soap12-test.inc"; ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>encodingStyle cannot be specified on the Body</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>encodingStyle cannot be specified on the Body</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> diff --git a/ext/soap/tests/soap12/T69.phpt b/ext/soap/tests/soap12/T69.phpt index 31cbda5d34..0fb02dec06 100644 --- a/ext/soap/tests/soap12/T69.phpt +++ b/ext/soap/tests/soap12/T69.phpt @@ -16,4 +16,4 @@ include "soap12-test.inc"; ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>Body must be present in a SOAP envelope</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>Body must be present in a SOAP envelope</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> diff --git a/ext/soap/tests/soap12/T70.phpt b/ext/soap/tests/soap12/T70.phpt index ecea4211a1..3622c320e7 100644 --- a/ext/soap/tests/soap12/T70.phpt +++ b/ext/soap/tests/soap12/T70.phpt @@ -20,4 +20,4 @@ include "soap12-test.inc"; ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>A SOAP 1.2 envelope can contain only Header and Body</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>A SOAP 1.2 envelope can contain only Header and Body</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> diff --git a/ext/soap/tests/soap12/T71.phpt b/ext/soap/tests/soap12/T71.phpt index 2e86e9af40..fdb5b8d460 100644 --- a/ext/soap/tests/soap12/T71.phpt +++ b/ext/soap/tests/soap12/T71.phpt @@ -21,4 +21,4 @@ include "soap12-test.inc"; ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>A SOAP Envelope element cannot have non Namespace qualified attributes</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>A SOAP Envelope element cannot have non Namespace qualified attributes</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> diff --git a/ext/soap/tests/soap12/T72.phpt b/ext/soap/tests/soap12/T72.phpt index c6c72592d6..b8f5060c6b 100644 --- a/ext/soap/tests/soap12/T72.phpt +++ b/ext/soap/tests/soap12/T72.phpt @@ -19,4 +19,4 @@ include "soap12-test.inc"; ?> --EXPECT-- <?xml version="1.0" encoding="UTF-8"?> -<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Receiver</env:Value></env:Code><env:Reason><env:Text>encodingStyle cannot be specified on the Envelope</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> +<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><env:Fault><env:Code><env:Value>env:Sender</env:Value></env:Code><env:Reason><env:Text>encodingStyle cannot be specified on the Envelope</env:Text></env:Reason></env:Fault></env:Body></env:Envelope> |