XML parsing warnings and notices were disabled.

This commit is contained in:
Dmitry Stogov 2004-01-13 09:31:50 +00:00
parent 51c86ab73f
commit fceb95f12a
4 changed files with 22 additions and 2 deletions

View file

@ -306,7 +306,7 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
http_close = TRUE;
connection = get_http_header_value(http_headers,"Connection: ");
if (connection) {
if (!strcmp(connection, "Keep-Alive")) {
if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
http_close = FALSE;
}
efree(connection);
@ -331,7 +331,8 @@ int get_http_soap_response(zval *this_ptr, char **buffer, int *buffer_len TSRMLS
cmplen = strlen(content_type);
}
if (strncmp(content_type, "text/xml", cmplen)) {
if (strncmp(content_type, "text/xml", cmplen) == 0 ||
strncmp(content_type, "application/soap+xml", cmplen == 0)) {
if (strncmp(http_body, "<?xml", 5)) {
zval *err;
MAKE_STD_ZVAL(err);

View file

@ -7,12 +7,19 @@ int parse_packet_soap(zval *this_ptr, char *buffer, int buffer_size, sdlFunction
xmlDocPtr response;
xmlNodePtr trav, env, head, body, resp, cur, fault;
int param_count = 0;
int old_error_reporting;
ZVAL_NULL(return_value);
old_error_reporting = EG(error_reporting);
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
/* Parse XML packet */
response = xmlParseMemory(buffer, buffer_size);
xmlCleanupParser();
EG(error_reporting) = old_error_reporting;
if (!response) {
add_soap_fault(this_ptr, "SOAP-ENV:Client", "looks like we got no XML document", NULL, NULL TSRMLS_CC);
return FALSE;

View file

@ -647,12 +647,19 @@ static void load_wsdl_ex(char *struri, sdlCtx *ctx, int include)
xmlDocPtr wsdl;
xmlNodePtr root, definitions, trav;
xmlAttrPtr targetNamespace;
int old_error_reporting;
/* TODO: WSDL Caching */
old_error_reporting = EG(error_reporting);
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
wsdl = xmlParseFile(struri);
xmlCleanupParser();
EG(error_reporting) = old_error_reporting;
if (!wsdl) {
php_error(E_ERROR, "SOAP-ERROR: Parsing WSDL: Couldn't load from %s", struri);
}

View file

@ -1052,9 +1052,14 @@ PHP_METHOD(soapserver, handle)
if (zend_hash_find(&EG(symbol_table), HTTP_RAW_POST_DATA, sizeof(HTTP_RAW_POST_DATA), (void **) &raw_post)!=FAILURE
&& ((*raw_post)->type==IS_STRING)) {
int old_error_reporting = EG(error_reporting);
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
doc_request = xmlParseMemory(Z_STRVAL_PP(raw_post),Z_STRLEN_PP(raw_post));
xmlCleanupParser();
EG(error_reporting) = old_error_reporting;
if (doc_request == NULL) {
php_error(E_ERROR, "Bad Request");
}