summaryrefslogtreecommitdiff
path: root/ext/soap
diff options
context:
space:
mode:
authorSVN Migration <svn@php.net>2008-12-03 20:30:45 +0000
committerSVN Migration <svn@php.net>2008-12-03 20:30:45 +0000
commit2876046398950e59c3b3c460e67e6fec7ff2ba3c (patch)
tree33b2b8b4b859960a6446ad19d0ada1c55f9cfcda /ext/soap
parent3fb86b0b9e79e6a3312b694f30ee627e2e1b325c (diff)
downloadphp-git-php-5.3.0alpha2.tar.gz
This commit was manufactured by cvs2svn to create tag 'php_5_3_0alpha2'.php-5.3.0alpha2
Diffstat (limited to 'ext/soap')
-rw-r--r--ext/soap/php_encoding.c72
-rw-r--r--ext/soap/php_http.c191
-rw-r--r--ext/soap/php_sdl.c12
-rw-r--r--ext/soap/soap.c248
-rw-r--r--ext/soap/tests/bugs/bug31755.phpt4
-rw-r--r--ext/soap/tests/bugs/bug44811.phpt4
6 files changed, 230 insertions, 301 deletions
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 2bba8acfa5..b6225270e8 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -361,7 +361,6 @@ static zend_bool soap_check_xml_ref(zval **data, xmlNodePtr node TSRMLS_DC)
static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xmlNodePtr parent, int check_class_map)
{
xmlNodePtr node = NULL;
- int add_type = 0;
TSRMLS_FETCH();
/* Special handling of class SoapVar */
@@ -448,21 +447,20 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
zend_binary_strncasecmp(ce->name, ce->name_length, Z_STRVAL_PP(tmp), ce->name_length, ce->name_length) == 0 &&
zend_hash_get_current_key_ex(SOAP_GLOBAL(class_map), &type_name, &type_len, &idx, 0, &pos) == HASH_KEY_IS_STRING) {
- /* TODO: namespace isn't stored */
- encodePtr enc = NULL;
- if (SOAP_GLOBAL(sdl)) {
- enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name);
- if (!enc) {
- enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name);
- }
- }
- if (enc) {
- if (encode != enc && style == SOAP_LITERAL) {
- add_type = 1;
- }
- encode = enc;
- }
- break;
+ /* TODO: namespace isn't stored */
+ encodePtr enc = NULL;
+ if (SOAP_GLOBAL(sdl)) {
+ enc = get_encoder(SOAP_GLOBAL(sdl), SOAP_GLOBAL(sdl)->target_ns, type_name);
+ }
+ if (enc) {
+ encode = enc;
+ } else if (SOAP_GLOBAL(sdl)) {
+ enc = find_encoder_by_type_name(SOAP_GLOBAL(sdl), type_name);
+ if (enc) {
+ encode = enc;
+ }
+ }
+ break;
}
}
}
@@ -487,9 +485,6 @@ static xmlNodePtr master_to_xml_int(encodePtr encode, zval *data, int style, xml
}
if (encode->to_xml) {
node = encode->to_xml(&encode->details, data, style, parent);
- if (add_type) {
- set_ns_and_type(node, &encode->details);
- }
}
}
return node;
@@ -1020,15 +1015,7 @@ static zval *to_zval_double(encodeTypePtr type, xmlNodePtr data)
Z_DVAL_P(ret) = dval;
break;
default:
- if (strncasecmp((char*)data->children->content, "NaN", sizeof("NaN")-1) == 0) {
- ZVAL_DOUBLE(ret, php_get_nan());
- } else if (strncasecmp((char*)data->children->content, "INF", sizeof("INF")-1) == 0) {
- ZVAL_DOUBLE(ret, php_get_inf());
- } else if (strncasecmp((char*)data->children->content, "-INF", sizeof("-INF")-1) == 0) {
- ZVAL_DOUBLE(ret, -php_get_inf());
- } else {
- soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
- }
+ soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
}
} else {
soap_error0(E_ERROR, "Encoding: Violation of encoding rules");
@@ -1458,7 +1445,7 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e
sdlPtr sdl;
sdlTypePtr sdlType = type->sdl_type;
zend_class_entry *ce = ZEND_STANDARD_CLASS_DEF_PTR;
- zval *redo_any = NULL;
+ zend_bool redo_any = 0;
TSRMLS_FETCH();
if (pce) {
@@ -1530,7 +1517,10 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e
if (soap_check_xml_ref(&ret, data TSRMLS_CC)) {
return ret;
}
- redo_any = get_zval_property(ret, "any" TSRMLS_CC);
+ if (get_zval_property(ret, "any" TSRMLS_CC) != NULL) {
+ unset_zval_property(ret, "any" TSRMLS_CC);
+ redo_any = 1;
+ }
if (Z_TYPE_P(ret) == IS_OBJECT && ce != ZEND_STANDARD_CLASS_DEF_PTR) {
zend_object *zobj = zend_objects_get_address(ret TSRMLS_CC);
zobj->ce = ce;
@@ -1556,17 +1546,10 @@ static zval *to_zval_object_ex(encodeTypePtr type, xmlNodePtr data, zend_class_e
object_init_ex(ret, ce);
}
if (sdlType->model) {
- if (redo_any) {
- Z_ADDREF_P(redo_any);
- unset_zval_property(ret, "any" TSRMLS_CC);
- }
model_to_zval_object(ret, sdlType->model, data, sdl TSRMLS_CC);
- if (redo_any) {
- if (get_zval_property(ret, "any" TSRMLS_CC) == NULL) {
- model_to_zval_any(ret, data->children TSRMLS_CC);
- }
- zval_ptr_dtor(&redo_any);
- }
+ if (redo_any && get_zval_property(ret, "any" TSRMLS_CC) == NULL) {
+ model_to_zval_any(ret, data->children TSRMLS_CC);
+ }
}
if (sdlType->attributes) {
sdlAttributePtr *attr;
@@ -1671,13 +1654,6 @@ static int model_to_xml_object(xmlNodePtr node, sdlContentModelPtr model, zval *
encodePtr enc;
data = get_zval_property(object, model->u.element->name TSRMLS_CC);
- if (data &&
- Z_TYPE_P(data) == IS_NULL &&
- !model->u.element->nillable &&
- model->min_occurs > 0 &&
- !strict) {
- return 0;
- }
if (data) {
enc = model->u.element->encode;
if ((model->max_occurs == -1 || model->max_occurs > 1) &&
@@ -2993,7 +2969,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
#ifdef HAVE_TM_GMTOFF
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", (ta->tm_gmtoff < 0) ? '-' : '+', abs(ta->tm_gmtoff / 3600), abs( (ta->tm_gmtoff % 3600) / 60 ));
#else
-# if defined(__CYGWIN__) || defined(NETWARE)
+# ifdef __CYGWIN__
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? _timezone - 3600:_timezone)>0)?'-':'+', abs((ta->tm_isdst ? _timezone - 3600 : _timezone) / 3600), abs(((ta->tm_isdst ? _timezone - 3600 : _timezone) % 3600) / 60));
# else
snprintf(tzbuf, sizeof(tzbuf), "%c%02d:%02d", ((ta->tm_isdst ? timezone - 3600:timezone)>0)?'-':'+', abs((ta->tm_isdst ? timezone - 3600 : timezone) / 3600), abs(((ta->tm_isdst ? timezone - 3600 : timezone) % 3600) / 60));
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 23d104b338..717a85d980 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -31,6 +31,30 @@ static int get_http_headers(php_stream *socketd,char **response, int *out_size T
#define smart_str_append_const(str, const) \
smart_str_appendl(str,const,sizeof(const)-1)
+static int stream_alive(php_stream *stream TSRMLS_DC)
+{
+ int socket;
+ char buf;
+
+ /* maybe better to use:
+ * php_stream_set_option(stream, PHP_STREAM_OPTION_CHECK_LIVENESS, 0, NULL)
+ * here instead */
+
+ if (stream == NULL || stream->eof || php_stream_cast(stream, PHP_STREAM_AS_FD_FOR_SELECT, (void**)&socket, 0) != SUCCESS) {
+ return FALSE;
+ }
+ if (socket == -1) {
+ return FALSE;
+ } else {
+ if (php_pollfd_for_ms(socket, PHP_POLLREADABLE, 0) > 0) {
+ if (0 == recv(socket, &buf, sizeof(buf), MSG_PEEK) && php_socket_errno() != EAGAIN) {
+ return FALSE;
+ }
+ }
+ }
+ return TRUE;
+}
+
/* Proxy HTTP Authentication */
void proxy_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
{
@@ -82,11 +106,12 @@ void basic_authentication(zval* this_ptr, smart_str* soap_headers TSRMLS_DC)
}
}
-static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, php_stream_context *context, int *use_proxy TSRMLS_DC)
+static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, int *use_proxy TSRMLS_DC)
{
php_stream *stream;
zval **proxy_host, **proxy_port, **tmp;
char *host;
+ php_stream_context *context = NULL;
char *name;
long namelen;
int port;
@@ -115,6 +140,11 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
old_error_reporting = EG(error_reporting);
EG(error_reporting) &= ~(E_WARNING|E_NOTICE|E_USER_WARNING|E_USER_NOTICE);
+ if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr),
+ "_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
+ context = php_stream_context_from_zval(*tmp, 0);
+ }
+
namelen = spprintf(&name, 0, "%s://%s:%d", (use_ssl && !*use_proxy)? "ssl" : "tcp", host, port);
stream = php_stream_xport_create(name, namelen,
@@ -210,7 +240,6 @@ int make_http_soap_request(zval *this_ptr,
char *content_encoding;
char *http_msg = NULL;
zend_bool old_allow_url_fopen;
- php_stream_context *context = NULL;
if (this_ptr == NULL || Z_TYPE_P(this_ptr) != IS_OBJECT) {
return FALSE;
@@ -278,11 +307,6 @@ int make_http_soap_request(zval *this_ptr,
phpurl = php_url_parse(location);
}
- if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr),
- "_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
- context = php_stream_context_from_zval(*tmp, 0);
- }
-
try_again:
if (phpurl == NULL || phpurl->host == NULL) {
if (phpurl != NULL) {php_url_free(phpurl);}
@@ -340,7 +364,7 @@ try_again:
}
/* Check if keep-alive connection is still opened */
- if (stream != NULL && php_stream_eof(stream)) {
+ if (stream != NULL && !stream_alive(stream TSRMLS_CC)) {
php_stream_close(stream);
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpurl", sizeof("httpurl"));
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
@@ -350,7 +374,7 @@ try_again:
}
if (!stream) {
- stream = http_connect(this_ptr, phpurl, use_ssl, context, &use_proxy TSRMLS_CC);
+ stream = http_connect(this_ptr, phpurl, use_ssl, &use_proxy TSRMLS_CC);
if (stream) {
php_stream_auto_cleanup(stream);
add_property_resource(this_ptr, "httpsocket", php_stream_get_resource_id(stream));
@@ -373,15 +397,6 @@ try_again:
add_property_resource(this_ptr, "httpurl", ret);
/*zend_list_addref(ret);*/
- if (context &&
- php_stream_context_get_option(context, "http", "protocol_version", &tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_DOUBLE &&
- Z_DVAL_PP(tmp) == 1.0) {
- http_1_1 = 0;
- } else {
- http_1_1 = 1;
- }
-
smart_str_append_const(&soap_headers, "POST ");
if (use_proxy && !use_ssl) {
smart_str_appends(&soap_headers, phpurl->scheme);
@@ -403,24 +418,19 @@ try_again:
smart_str_appendc(&soap_headers, '#');
smart_str_appends(&soap_headers, phpurl->fragment);
}
- if (http_1_1) {
- smart_str_append_const(&soap_headers, " HTTP/1.1\r\n");
- } else {
- smart_str_append_const(&soap_headers, " HTTP/1.0\r\n");
- }
- smart_str_append_const(&soap_headers, "Host: ");
+ smart_str_append_const(&soap_headers, " HTTP/1.1\r\n"
+ "Host: ");
smart_str_appends(&soap_headers, phpurl->host);
if (phpurl->port != (use_ssl?443:80)) {
smart_str_appendc(&soap_headers, ':');
smart_str_append_unsigned(&soap_headers, phpurl->port);
}
- if (http_1_1) {
- smart_str_append_const(&soap_headers, "\r\n"
- "Connection: Keep-Alive\r\n");
- } else {
- smart_str_append_const(&soap_headers, "\r\n"
- "Connection: close\r\n");
- }
+ smart_str_append_const(&soap_headers, "\r\n"
+ "Connection: Keep-Alive\r\n");
+/*
+ "Connection: close\r\n"
+ "Accept: text/html; text/xml; text/plain\r\n"
+*/
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent"), (void **)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
if (Z_STRLEN_PP(tmp) > 0) {
@@ -428,14 +438,6 @@ try_again:
smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
smart_str_append_const(&soap_headers, "\r\n");
}
- } else if (context &&
- php_stream_context_get_option(context, "http", "user_agent", &tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING) {
- if (Z_STRLEN_PP(tmp) > 0) {
- smart_str_append_const(&soap_headers, "User-Agent: ");
- smart_str_appendl(&soap_headers, Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
- smart_str_append_const(&soap_headers, "\r\n");
- }
} else{
smart_str_append_const(&soap_headers, "User-Agent: PHP-SOAP/"PHP_VERSION"\r\n");
}
@@ -673,64 +675,6 @@ try_again:
smart_str_append_const(&soap_headers, "\r\n");
}
}
-
- if (context &&
- php_stream_context_get_option(context, "http", "header", &tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING && Z_STRLEN_PP(tmp)) {
- char *s = Z_STRVAL_PP(tmp);
- char *p;
- int name_len;
-
- while (*s) {
- /* skip leading newlines and spaces */
- while (*s == ' ' || *s == '\t' || *s == '\r' || *s == '\n') {
- s++;
- }
- /* extract header name */
- p = s;
- name_len = -1;
- while (*p) {
- if (*p == ':') {
- if (name_len < 0) name_len = p - s;
- break;
- } else if (*p == ' ' || *p == '\t') {
- if (name_len < 0) name_len = p - s;
- } else if (*p == '\r' || *p == '\n') {
- break;
- }
- p++;
- }
- if (*p == ':') {
- /* extract header value */
- while (*p && *p != '\r' && *p != '\n') {
- p++;
- }
- /* skip some predefined headers */
- if ((name_len != sizeof("host")-1 ||
- strncasecmp(s, "host", sizeof("host")-1) != 0) &&
- (name_len != sizeof("connection")-1 ||
- strncasecmp(s, "connection", sizeof("connection")-1) != 0) &&
- (name_len != sizeof("user-agent")-1 ||
- strncasecmp(s, "user-agent", sizeof("user-agent")-1) != 0) &&
- (name_len != sizeof("content-length")-1 ||
- strncasecmp(s, "content-length", sizeof("content-length")-1) != 0) &&
- (name_len != sizeof("content-type")-1 ||
- strncasecmp(s, "content-type", sizeof("content-type")-1) != 0) &&
- (name_len != sizeof("cookie")-1 ||
- strncasecmp(s, "cookie", sizeof("cookie")-1) != 0) &&
- (name_len != sizeof("authorization")-1 ||
- strncasecmp(s, "authorization", sizeof("authorization")-1) != 0) &&
- (name_len != sizeof("proxy-authorization")-1 ||
- strncasecmp(s, "proxy-authorization", sizeof("proxy-authorization")-1) != 0)) {
- /* add header */
- smart_str_appendl(&soap_headers, s, p-s);
- smart_str_append_const(&soap_headers, "\r\n");
- }
- }
- s = (*p) ? (p + 1) : p;
- }
- }
-
smart_str_append_const(&soap_headers, "\r\n");
smart_str_0(&soap_headers);
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "trace", sizeof("trace"), (void **) &trace) == SUCCESS &&
@@ -899,7 +843,6 @@ try_again:
efree(cookie);
}
- /* See if the server requested a close */
if (http_1_1) {
http_close = FALSE;
if (use_proxy && !use_ssl) {
@@ -911,35 +854,8 @@ try_again:
efree(connection);
}
}
- if (http_close == FALSE) {
- connection = get_http_header_value(http_headers,"Connection: ");
- if (connection) {
- if (strncasecmp(connection, "close", sizeof("close")-1) == 0) {
- http_close = TRUE;
- }
- efree(connection);
- }
- }
} else {
http_close = TRUE;
- if (use_proxy && !use_ssl) {
- connection = get_http_header_value(http_headers,"Proxy-Connection: ");
- if (connection) {
- if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
- http_close = FALSE;
- }
- efree(connection);
- }
- }
- if (http_close == TRUE) {
- connection = get_http_header_value(http_headers,"Connection: ");
- if (connection) {
- if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
- http_close = FALSE;
- }
- efree(connection);
- }
- }
}
if (!get_http_body(stream, http_close, http_headers, &http_body, &http_body_size TSRMLS_CC)) {
@@ -958,6 +874,31 @@ try_again:
if (request != buf) {efree(request);}
+ /* See if the server requested a close */
+ http_close = TRUE;
+ connection = get_http_header_value(http_headers,"Proxy-Connection: ");
+ if (connection) {
+ if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
+ http_close = FALSE;
+ }
+ efree(connection);
+/*
+ } else if (http_1_1) {
+ http_close = FALSE;
+*/
+ }
+ connection = get_http_header_value(http_headers,"Connection: ");
+ if (connection) {
+ if (strncasecmp(connection, "Keep-Alive", sizeof("Keep-Alive")-1) == 0) {
+ http_close = FALSE;
+ }
+ efree(connection);
+/*
+ } else if (http_1_1) {
+ http_close = FALSE;
+*/
+ }
+
if (http_close) {
php_stream_close(stream);
zend_hash_del(Z_OBJPROP_P(this_ptr), "httpsocket", sizeof("httpsocket"));
diff --git a/ext/soap/php_sdl.c b/ext/soap/php_sdl.c
index 2ed545bd9e..fcc90aa742 100644
--- a/ext/soap/php_sdl.c
+++ b/ext/soap/php_sdl.c
@@ -3152,8 +3152,6 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
if (SUCCESS == zend_hash_find(Z_OBJPROP_P(this_ptr),
"_stream_context", sizeof("_stream_context"), (void**)&tmp)) {
context = php_stream_context_from_zval(*tmp, 0);
- } else {
- context = php_stream_context_alloc();
}
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS &&
@@ -3191,16 +3189,6 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, long cache_wsdl TSRMLS_DC)
basic_authentication(this_ptr, &headers TSRMLS_CC);
- /* Use HTTP/1.1 with "Connection: close" by default */
- if (php_stream_context_get_option(context, "http", "protocol_version", &tmp) == FAILURE) {
- zval *http_version;
- MAKE_STD_ZVAL(http_version);
- ZVAL_DOUBLE(http_version, 1.1);
- php_stream_context_set_option(context, "http", "protocol_version", http_version);
- zval_ptr_dtor(&http_version);
- smart_str_appendl(&headers, "Connection: close", sizeof("Connection: close")-1);
- }
-
if (headers.len > 0) {
zval *str_headers;
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index 78f4326e4e..466e0e534a 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -279,11 +279,13 @@ PHP_METHOD(SoapHeader, SoapHeader);
/* {{{ arginfo */
#ifdef ZEND_ENGINE_2
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapparam_soapparam, 0, 0, 2)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2)
ZEND_ARG_INFO(0, namespace)
ZEND_ARG_INFO(0, name)
@@ -292,6 +294,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapheader_soapheader, 0, 0, 2)
ZEND_ARG_INFO(0, actor)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2)
ZEND_ARG_INFO(0, faultcode)
ZEND_ARG_INFO(0, faultstring)
@@ -301,6 +304,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapfault_soapfault, 0, 0, 2)
ZEND_ARG_INFO(0, headerfault)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar_soapvar, 0, 0, 2)
ZEND_ARG_INFO(0, data)
ZEND_ARG_INFO(0, encoding)
@@ -310,6 +314,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapvar_soapvar, 0, 0, 2)
ZEND_ARG_INFO(0, node_namespace)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_fault, 0, 0, 2)
ZEND_ARG_INFO(0, code)
ZEND_ARG_INFO(0, string)
@@ -318,49 +323,60 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_fault, 0, 0, 2)
ZEND_ARG_INFO(0, name)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addsoapheader, 0, 0, 1)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_soapserver, 0, 0, 1)
ZEND_ARG_INFO(0, wsdl)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setpersistence, 0, 0, 1)
ZEND_ARG_INFO(0, mode)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setclass, 0, 0, 1)
ZEND_ARG_INFO(0, class_name)
ZEND_ARG_INFO(0, args)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_setobject, 0, 0, 1)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_soapserver_getfunctions, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_addfunction, 0, 0, 1)
ZEND_ARG_INFO(0, functions)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapserver_handle, 0, 0, 0)
ZEND_ARG_INFO(0, soap_request)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient_soapclient, 0, 0, 1)
ZEND_ARG_INFO(0, wsdl)
ZEND_ARG_INFO(0, options)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___call, 0, 0, 2)
ZEND_ARG_INFO(0, function_name)
ZEND_ARG_INFO(0, arguments)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___soapcall, 0, 0, 2)
ZEND_ARG_INFO(0, function_name)
ZEND_ARG_INFO(0, arguments)
@@ -369,24 +385,31 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___soapcall, 0, 0, 2)
ZEND_ARG_INFO(1, output_headers)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getfunctions, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_soapclient___gettypes, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastrequest, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastresponse, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastrequestheaders, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO(arginfo_soapclient___getlastresponseheaders, 0)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___dorequest, 0, 0, 4)
ZEND_ARG_INFO(0, request)
ZEND_ARG_INFO(0, location)
@@ -395,23 +418,28 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___dorequest, 0, 0, 4)
ZEND_ARG_INFO(0, one_way)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setcookie, 0, 0, 1)
ZEND_ARG_INFO(0, name)
ZEND_ARG_INFO(0, value)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setsoapheaders, 0, 0, 1)
ZEND_ARG_INFO(0, soapheaders)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soapclient___setlocation, 0, 0, 0)
ZEND_ARG_INFO(0, new_location)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soap_use_soap_error_handler, 0, 0, 0)
ZEND_ARG_INFO(0, handler)
ZEND_END_ARG_INFO()
+static
ZEND_BEGIN_ARG_INFO_EX(arginfo_soap_is_soap_fault, 0, 0, 1)
ZEND_ARG_INFO(0, object)
ZEND_END_ARG_INFO()
@@ -859,11 +887,10 @@ PHP_METHOD(SoapParam, SoapParam)
int name_length;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &data, &name, &name_length) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
if (name_length == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid parameter name");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid parameter name.");
}
#ifndef ZEND_ENGINE_2
@@ -885,15 +912,13 @@ 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) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
if (ns_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid namespace");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid namespace.");
}
if (name_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid header name");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid header name.");
}
add_property_stringl(this_ptr, "namespace", ns, ns_len, 1);
@@ -914,7 +939,7 @@ PHP_METHOD(SoapHeader, SoapHeader)
} else if (Z_TYPE_P(actor) == IS_STRING && Z_STRLEN_P(actor) > 0) {
add_property_stringl(this_ptr, "actor", Z_STRVAL_P(actor), Z_STRLEN_P(actor), 1);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid actor");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid actor.");
}
}
@@ -923,7 +948,7 @@ PHP_METHOD(SoapHeader, SoapHeader)
PHP_METHOD(SoapFault, SoapFault)
{
char *fault_string = NULL, *fault_code = NULL, *fault_actor = NULL, *name = NULL, *fault_code_ns = NULL;
- int fault_string_len, fault_actor_len = 0, name_len = 0, fault_code_len = 0;
+ int fault_string_len, fault_actor_len, name_len, fault_code_len = 0;
zval *code = NULL, *details = NULL, *headerfault = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|s!z!s!z",
@@ -931,9 +956,8 @@ PHP_METHOD(SoapFault, SoapFault)
&fault_string, &fault_string_len,
&fault_actor, &fault_actor_len,
&details, &name, &name_len, &headerfault) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
-
if (Z_TYPE_P(code) == IS_NULL) {
} else if (Z_TYPE_P(code) == IS_STRING) {
fault_code = Z_STRVAL_P(code);
@@ -950,16 +974,13 @@ PHP_METHOD(SoapFault, SoapFault)
fault_code = Z_STRVAL_PP(t_code);
fault_code_len = Z_STRLEN_PP(t_code);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fault code");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid fault code.");
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fault code");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid fault code.");
}
if (fault_code != NULL && fault_code_len == 0) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid fault code");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters. Invalid fault code.");
}
if (name != NULL && name_len == 0) {
name = NULL;
@@ -999,7 +1020,7 @@ PHP_METHOD(SoapFault, __toString)
fci.function_table = &Z_OBJCE_P(getThis())->function_table;
fci.function_name = &fname;
fci.symbol_table = NULL;
- fci.object_ptr = getThis();
+ fci.object_pp = &getThis();
fci.retval_ptr_ptr = &trace;
fci.param_count = 0;
fci.params = NULL;
@@ -1024,10 +1045,10 @@ PHP_METHOD(SoapVar, SoapVar)
{
zval *data, *type;
char *stype = NULL, *ns = NULL, *name = NULL, *namens = NULL;
- int stype_len = 0, ns_len = 0, name_len = 0, namens_len = 0;
+ 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) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
if (Z_TYPE_P(type) == IS_NULL) {
@@ -1036,8 +1057,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_docref(NULL TSRMLS_CC, E_WARNING, "Invalid type ID");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid type ID");
}
}
@@ -1080,8 +1100,7 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht TSRMLS_DC)
encodePtr enc, new_enc;
if (Z_TYPE_PP(tmp) != IS_ARRAY) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Wrong 'typemap' option");
- return NULL;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Wrong 'typemap' option");
}
ht2 = Z_ARRVAL_PP(tmp);
@@ -1186,7 +1205,7 @@ static HashTable* soap_create_typemap(sdlPtr sdl, HashTable *ht TSRMLS_DC)
PHP_METHOD(SoapServer, SoapServer)
{
soapServicePtr service;
- zval *wsdl = NULL, *options = NULL;
+ zval *wsdl, *options = NULL;
int ret;
int version = SOAP_1_1;
long cache_wsdl;
@@ -1194,14 +1213,17 @@ PHP_METHOD(SoapServer, SoapServer)
SOAP_SERVER_BEGIN_CODE();
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
- if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
+ if (Z_TYPE_P(wsdl) == IS_STRING) {
+ } else if (Z_TYPE_P(wsdl) == IS_NULL) {
+ wsdl = NULL;
+ } else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
-
+
service = emalloc(sizeof(soapService));
memset(service, 0, sizeof(soapService));
service->send_errors = 1;
@@ -1222,8 +1244,9 @@ PHP_METHOD(SoapServer, SoapServer)
if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
service->uri = estrndup(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp));
- } else if (Z_TYPE_P(wsdl) == IS_NULL) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode");
+ } else if (wsdl == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is required in nonWSDL mode.");
+ return;
}
if (zend_hash_find(ht, "actor", sizeof("actor"), (void**)&tmp) == SUCCESS &&
@@ -1236,11 +1259,11 @@ PHP_METHOD(SoapServer, SoapServer)
xmlCharEncodingHandlerPtr encoding;
encoding = xmlFindCharEncodingHandler(Z_STRVAL_PP(tmp));
- if (encoding == NULL) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_PP(tmp));
- } else {
- service->encoding = encoding;
- }
+ if (encoding == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. Invalid 'encoding' option - '%s'.", Z_STRVAL_PP(tmp));
+ } else {
+ service->encoding = encoding;
+ }
}
if (zend_hash_find(ht, "classmap", sizeof("classmap"), (void**)&tmp) == SUCCESS &&
@@ -1273,8 +1296,8 @@ PHP_METHOD(SoapServer, SoapServer)
service->send_errors = Z_LVAL_PP(tmp);
}
- } else if (Z_TYPE_P(wsdl) == IS_NULL) {
- php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode");
+ } else if (wsdl == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid arguments. 'uri' option is required in nonWSDL mode.");
}
service->version = version;
@@ -1283,7 +1306,7 @@ PHP_METHOD(SoapServer, SoapServer)
service->soap_functions.ft = emalloc(sizeof(HashTable));
zend_hash_init(service->soap_functions.ft, 0, NULL, ZVAL_PTR_DTOR, 0);
- if (Z_TYPE_P(wsdl) != IS_NULL) {
+ if (wsdl) {
service->sdl = get_sdl(this_ptr, Z_STRVAL_P(wsdl), cache_wsdl TSRMLS_CC);
if (service->uri == NULL) {
if (service->sdl->target_ns) {
@@ -1324,12 +1347,10 @@ PHP_METHOD(SoapServer, setPersistence)
value == SOAP_PERSISTENCE_REQUEST) {
service->soap_class.persistance = value;
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set persistence with bogus value (%ld)", value);
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to set persistence with bogus value (%ld)", value);
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set persistence when you are using you SOAP SERVER in function mode, no persistence needed");
- return;
+ 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");
}
}
@@ -1385,8 +1406,7 @@ PHP_METHOD(SoapServer, setClass)
}
}
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to set a non existant class (%s)", classname);
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Tried to set a non existant class (%s)", classname);
}
if (argv) {
@@ -1410,7 +1430,7 @@ PHP_METHOD(SoapServer, setObject)
FETCH_THIS_SERVICE(service);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &obj) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
service->type = SOAP_OBJECT;
@@ -1487,7 +1507,7 @@ PHP_METHOD(SoapServer, addFunction)
FETCH_THIS_SERVICE(service);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &function_name) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
/* TODO: could use zend_is_callable here */
@@ -1509,8 +1529,7 @@ PHP_METHOD(SoapServer, addFunction)
zend_function *f;
if (Z_TYPE_PP(tmp_function) != IS_STRING) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a function that isn't a string");
- return;
+ 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);
@@ -1518,8 +1537,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_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_PP(tmp_function));
- return;
+ 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);
@@ -1540,8 +1558,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_docref(NULL TSRMLS_CC, E_WARNING, "Tried to add a non existant function '%s'", Z_STRVAL_P(function_name));
- return;
+ 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;
@@ -1562,8 +1579,7 @@ PHP_METHOD(SoapServer, addFunction)
}
service->soap_functions.functions_all = TRUE;
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value passed");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid value passed");
}
}
@@ -1588,7 +1604,7 @@ PHP_METHOD(SoapServer, handle)
soapHeader *soap_headers = NULL;
sdlFunctionPtr function;
char *arg = NULL;
- int arg_len = 0;
+ int arg_len;
xmlCharEncodingHandlerPtr old_encoding;
HashTable *old_class_map, *old_typemap;
int old_features;
@@ -1597,9 +1613,8 @@ 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) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
if (SG(request_info).request_method &&
@@ -1686,16 +1701,14 @@ PHP_METHOD(SoapServer, handle)
ZVAL_STRINGL(params[0], post_data, post_data_length, 0);
INIT_PZVAL(params[0]);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING,"Request is compressed with unknown compression '%s'",Z_STRVAL_PP(encoding));
- return;
+ 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_docref(NULL TSRMLS_CC, E_WARNING,"Can't uncompress compressed request");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR,"Can't uncompress compressed request");
}
} else {
doc_request = soap_xmlParseMemory(post_data, post_data_length);
@@ -1893,8 +1906,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_docref(NULL TSRMLS_CC, E_WARNING, "Function '%s' call failed", Z_STRVAL(h->function_name));
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Function '%s' call failed", Z_STRVAL(h->function_name));
}
if (Z_TYPE(h->retval) == IS_OBJECT &&
instanceof_function(Z_OBJCE(h->retval), soap_fault_class_entry TSRMLS_CC)) {
@@ -1998,8 +2010,7 @@ PHP_METHOD(SoapServer, handle)
doc_return = serialize_response_call(function, response_name, service->uri, retval, soap_headers, soap_version TSRMLS_CC);
efree(response_name);
} else {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Function '%s' call failed", Z_STRVAL(function_name));
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Function '%s' call failed", Z_STRVAL(function_name));
}
#ifdef ZEND_ENGINE_2
@@ -2126,7 +2137,7 @@ fail:
PHP_METHOD(SoapServer, fault)
{
char *code, *string, *actor=NULL, *name=NULL;
- int code_len, string_len, actor_len = 0, name_len = 0;
+ int code_len, string_len, actor_len, name_len;
zval* details = NULL;
SOAP_SERVER_BEGIN_CODE();
@@ -2134,7 +2145,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) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
soap_server_fault(code, string, actor, details, name TSRMLS_CC);
@@ -2153,12 +2164,11 @@ PHP_METHOD(SoapServer, addSoapHeader)
FETCH_THIS_SERVICE(service);
if (!service || !service->soap_headers_ptr) {
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "The SoapServer::addSoapHeader function may be called only during SOAP request processing");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "The SoapServer::addSoapHeader function may be called only during SOAP request processing");
}
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "O", &fault, soap_header_class_entry) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
p = service->soap_headers_ptr;
@@ -2474,7 +2484,8 @@ PHP_FUNCTION(is_soap_fault)
PHP_METHOD(SoapClient, SoapClient)
{
- zval *wsdl, *options = NULL;
+ zval *wsdl;
+ zval *options = NULL;
int soap_version = SOAP_1_1;
php_stream_context *context = NULL;
long cache_wsdl;
@@ -2483,12 +2494,17 @@ PHP_METHOD(SoapClient, SoapClient)
SOAP_CLIENT_BEGIN_CODE();
- if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) {
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z|a", &wsdl, &options) == FAILURE) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
+ return;
}
- if (Z_TYPE_P(wsdl) != IS_STRING && Z_TYPE_P(wsdl) != IS_NULL) {
+ if (Z_TYPE_P(wsdl) == IS_STRING) {
+ } else if (Z_TYPE_P(wsdl) != IS_NULL ) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "$wsdl must be string or null");
+ return;
+ } else {
+ wsdl = NULL;
}
cache_wsdl = SOAP_GLOBAL(cache);
@@ -2497,13 +2513,14 @@ PHP_METHOD(SoapClient, SoapClient)
HashTable *ht = Z_ARRVAL_P(options);
zval **tmp;
- if (Z_TYPE_P(wsdl) == IS_NULL) {
+ if (wsdl == NULL) {
/* Fetching non-WSDL mode options */
if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "uri", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
} else {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'uri' option is required in nonWSDL mode");
+ return;
}
if (zend_hash_find(ht, "style", sizeof("style"), (void**)&tmp) == SUCCESS &&
@@ -2522,14 +2539,14 @@ PHP_METHOD(SoapClient, SoapClient)
if (zend_hash_find(ht, "stream_context", sizeof("stream_context"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_RESOURCE) {
context = php_stream_context_from_zval(*tmp, 1);
- zend_list_addref(context->rsrc_id);
}
if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "location", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
- } else if (Z_TYPE_P(wsdl) == IS_NULL) {
+ } else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' option is required in nonWSDL mode");
+ return;
}
if (zend_hash_find(ht, "soap_version", sizeof("soap_version"), (void**)&tmp) == SUCCESS) {
@@ -2604,10 +2621,10 @@ PHP_METHOD(SoapClient, SoapClient)
xmlCharEncodingHandlerPtr encoding;
encoding = xmlFindCharEncodingHandler(Z_STRVAL_PP(tmp));
- if (encoding == NULL) {
+ if (encoding == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_PP(tmp));
- } else {
- xmlCharEncCloseFunc(encoding);
+ } else {
+ xmlCharEncCloseFunc(encoding);
add_property_stringl(this_ptr, "_encoding", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
}
}
@@ -2656,13 +2673,15 @@ PHP_METHOD(SoapClient, SoapClient)
Z_TYPE_PP(tmp) == IS_STRING) {
add_property_stringl(this_ptr, "_user_agent", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
}
- } else if (Z_TYPE_P(wsdl) == IS_NULL) {
+
+ } else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode");
+ return;
}
add_property_long(this_ptr, "_soap_version", soap_version);
- if (Z_TYPE_P(wsdl) != IS_NULL) {
+ if (wsdl) {
int old_soap_version, ret;
old_soap_version = SOAP_GLOBAL(soap_version);
@@ -2999,26 +3018,30 @@ PHP_METHOD(SoapClient, __call)
HashPosition pos;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|a!zz",
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "sa|zzz",
&function, &function_len, &args, &options, &headers, &output_headers) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
if (options) {
- HashTable *ht = Z_ARRVAL_P(options);
- if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING) {
- location = Z_STRVAL_PP(tmp);
- }
+ if (Z_TYPE_P(options) == IS_ARRAY) {
+ HashTable *ht = Z_ARRVAL_P(options);
+ if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ location = Z_STRVAL_PP(tmp);
+ }
- if (zend_hash_find(ht, "soapaction", sizeof("soapaction"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING) {
- soap_action = Z_STRVAL_PP(tmp);
- }
+ if (zend_hash_find(ht, "soapaction", sizeof("soapaction"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ soap_action = Z_STRVAL_PP(tmp);
+ }
- if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING) {
- uri = Z_STRVAL_PP(tmp);
+ if (zend_hash_find(ht, "uri", sizeof("uri"), (void**)&tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ uri = Z_STRVAL_PP(tmp);
+ }
+ } else if (Z_TYPE_P(options) != IS_NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "first parameter must be string or null");
}
}
@@ -3035,8 +3058,7 @@ PHP_METHOD(SoapClient, __call)
Z_ADDREF_P(headers);
free_soap_headers = 1;
} else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid SOAP header");
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid SOAP header");
}
/* Add default headers */
@@ -3237,7 +3259,7 @@ PHP_METHOD(SoapClient, __doRequest)
&location, &location_size,
&action, &action_size,
&version, &one_way) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
}
if (SOAP_GLOBAL(features) & SOAP_WAIT_ONE_WAY_CALLS) {
one_way = 0;
@@ -3263,11 +3285,13 @@ PHP_METHOD(SoapClient, __setCookie)
{
char *name;
char *val = NULL;
- int name_len, val_len = 0;
+ int name_len, val_len;
zval **cookies;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &name, &name_len, &val, &val_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s",
+ &name, &name_len, &val, &val_len) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
+ RETURN_NULL();
}
if (val == NULL) {
@@ -3302,7 +3326,8 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
zval *headers = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|z", &headers) == FAILURE) {
- return;
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
+ RETURN_NULL();
}
if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) {
@@ -3324,7 +3349,7 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
Z_DELREF_P(default_headers);
add_property_zval(this_ptr, "__default_headers", default_headers);
} else{
- php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid SOAP header");
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid SOAP header");
}
RETURN_TRUE;
}
@@ -3341,19 +3366,20 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
PHP_METHOD(SoapClient, __setLocation)
{
char *location = NULL;
- int location_len = 0;
+ int location_len;
zval **tmp;
- if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s", &location, &location_len) == FAILURE) {
- return;
+ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|s",
+ &location, &location_len) == FAILURE) {
+ php_error_docref(NULL TSRMLS_CC, E_ERROR, "Invalid parameters");
+ RETURN_NULL();
}
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &tmp) == SUCCESS && Z_TYPE_PP(tmp) == IS_STRING) {
- RETVAL_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
+ if (zend_hash_find(Z_OBJPROP_P(this_ptr), "location", sizeof("location"),(void **) &tmp) == SUCCESS &&
+ Z_TYPE_PP(tmp) == IS_STRING) {
+ RETVAL_STRINGL(Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
} else {
RETVAL_NULL();
}
-
if (location && location_len) {
add_property_stringl(this_ptr, "location", location, location_len, 1);
} else {
diff --git a/ext/soap/tests/bugs/bug31755.phpt b/ext/soap/tests/bugs/bug31755.phpt
index 1d65b3a42b..1346d3b923 100644
--- a/ext/soap/tests/bugs/bug31755.phpt
+++ b/ext/soap/tests/bugs/bug31755.phpt
@@ -14,6 +14,4 @@ $response= $client->__call('function', array(), null, $header);
print $client->__getLastRequest();
?>
--EXPECTF--
-Warning: SoapHeader::SoapHeader(): Invalid namespace in %s on line %d
-<?xml version="1.0" encoding="UTF-8"?>
-<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="myNS" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header/><SOAP-ENV:Body><ns1:function/></SOAP-ENV:Body></SOAP-ENV:Envelope>
+Fatal error: SoapHeader::SoapHeader(): Invalid parameters. Invalid namespace. in %s on line %d
diff --git a/ext/soap/tests/bugs/bug44811.phpt b/ext/soap/tests/bugs/bug44811.phpt
index 8cfc4a76cd..b2e1fc4f6f 100644
--- a/ext/soap/tests/bugs/bug44811.phpt
+++ b/ext/soap/tests/bugs/bug44811.phpt
@@ -13,7 +13,7 @@ try {
}
die('ok');
?>
---EXPECTF--
-SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://slashdot.org' : %s
+--EXPECT--
+SOAP-ERROR: Parsing WSDL: Couldn't load from 'http://slashdot.org' : Premature end of data in tag html line 3
ok