1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Declare remaining SoapClient properties

This commit is contained in:
Nikita Popov
2021-08-19 15:56:26 +02:00
parent b3b1658492
commit e6c6abf6b4
7 changed files with 458 additions and 251 deletions

View File

@@ -32,23 +32,22 @@ static zend_string *get_http_headers(php_stream *socketd);
/* Proxy HTTP Authentication */
int proxy_authentication(zval* this_ptr, smart_str* soap_headers)
{
zval *login, *password;
if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_login", sizeof("_proxy_login")-1)) != NULL &&
Z_TYPE_P(login) == IS_STRING) {
zend_string *buf;
zval *login = Z_CLIENT_PROXY_LOGIN_P(this_ptr);
ZVAL_DEREF(login);
if (Z_TYPE_P(login) == IS_STRING) {
smart_str auth = {0};
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_append(&auth, Z_STR_P(login));
smart_str_appendc(&auth, ':');
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_password", sizeof("_proxy_password")-1)) != NULL &&
Z_TYPE_P(password) == IS_STRING) {
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
zval *password = Z_CLIENT_PROXY_PASSWORD_P(this_ptr);
ZVAL_DEREF(password);
if (Z_TYPE_P(password) == IS_STRING) {
smart_str_append(&auth, Z_STR_P(password));
}
smart_str_0(&auth);
buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
zend_string *buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
smart_str_append_const(soap_headers, "Proxy-Authorization: Basic ");
smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf));
smart_str_append(soap_headers, buf);
smart_str_append_const(soap_headers, "\r\n");
zend_string_release_ex(buf, 0);
smart_str_free(&auth);
@@ -60,24 +59,25 @@ int proxy_authentication(zval* this_ptr, smart_str* soap_headers)
/* HTTP Authentication */
int basic_authentication(zval* this_ptr, smart_str* soap_headers)
{
zval *login, *password, *use_digest;
zval *login = Z_CLIENT_LOGIN_P(this_ptr);
zval *use_digest = Z_CLIENT_USE_DIGEST_P(this_ptr);
ZVAL_DEREF(login);
ZVAL_DEREF(use_digest);
if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL &&
Z_TYPE_P(login) == IS_STRING &&
((use_digest = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_digest", sizeof("_use_digest")-1)) == 0 || Z_TYPE_P(use_digest) != IS_TRUE)) {
zend_string* buf;
if (Z_TYPE_P(login) == IS_STRING && Z_TYPE_P(use_digest) != IS_TRUE) {
smart_str auth = {0};
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_append(&auth, Z_STR_P(login));
smart_str_appendc(&auth, ':');
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
Z_TYPE_P(password) == IS_STRING) {
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
zval *password = Z_CLIENT_PASSWORD_P(this_ptr);
ZVAL_DEREF(password);
if (Z_TYPE_P(password) == IS_STRING) {
smart_str_append(&auth, Z_STR_P(password));
}
smart_str_0(&auth);
buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
zend_string *buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
smart_str_append_const(soap_headers, "Authorization: Basic ");
smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf));
smart_str_append(soap_headers, buf);
smart_str_append_const(soap_headers, "\r\n");
zend_string_release_ex(buf, 0);
smart_str_free(&auth);
@@ -159,7 +159,7 @@ void http_context_headers(php_stream_context* context,
static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, php_stream_context *context, int *use_proxy)
{
php_stream *stream;
zval *proxy_host, *proxy_port, *tmp, ssl_proxy_peer_name;
zval *tmp, ssl_proxy_peer_name;
char *host;
char *name;
char *protocol;
@@ -169,10 +169,11 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
struct timeval tv;
struct timeval *timeout = NULL;
if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL &&
Z_TYPE_P(proxy_host) == IS_STRING &&
(proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL &&
Z_TYPE_P(proxy_port) == IS_LONG) {
zval *proxy_host = Z_CLIENT_PROXY_HOST_P(this_ptr);
zval *proxy_port = Z_CLIENT_PROXY_PORT_P(this_ptr);
ZVAL_DEREF(proxy_host);
ZVAL_DEREF(proxy_port);
if (Z_TYPE_P(proxy_host) == IS_STRING && Z_TYPE_P(proxy_port) == IS_LONG) {
host = Z_STRVAL_P(proxy_host);
port = Z_LVAL_P(proxy_port);
*use_proxy = 1;
@@ -180,10 +181,12 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
host = ZSTR_VAL(phpurl->host);
port = phpurl->port;
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_connection_timeout", sizeof("_connection_timeout")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) > 0) {
tv.tv_sec = Z_LVAL_P(tmp);
tv.tv_usec = 0;
tmp = Z_CLIENT_CONNECTION_TIMEOUT_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) > 0) {
tv.tv_sec = Z_LVAL_P(tmp);
tv.tv_usec = 0;
timeout = &tv;
}
@@ -192,8 +195,9 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
/* Changed ternary operator to an if/else so that additional comparisons can be done on the ssl_method property */
if (use_ssl && !*use_proxy) {
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG) {
tmp = Z_CLIENT_SSL_METHOD_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_LONG) {
/* uses constants declared in soap.c to determine ssl uri protocol */
switch (Z_LVAL_P(tmp)) {
case SOAP_SSL_METHOD_TLS:
@@ -280,8 +284,9 @@ static php_stream* http_connect(zval* this_ptr, php_url *phpurl, int use_ssl, ph
/* if a stream is created without encryption, check to see if SSL method parameter is specified and use
proper encrypyion method based on constants defined in soap.c */
int crypto_method = STREAM_CRYPTO_METHOD_SSLv23_CLIENT;
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_ssl_method", sizeof("_ssl_method")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG) {
tmp = Z_CLIENT_SSL_METHOD_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_LONG) {
switch (Z_LVAL_P(tmp)) {
case SOAP_SSL_METHOD_TLS:
crypto_method = STREAM_CRYPTO_METHOD_TLS_CLIENT;
@@ -420,7 +425,9 @@ int make_http_soap_request(zval *this_ptr,
tmp = Z_CLIENT_HTTPSOCKET_P(this_ptr);
if (Z_TYPE_P(tmp) == IS_RESOURCE) {
php_stream_from_zval_no_verify(stream,tmp);
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1)) != NULL && Z_TYPE_P(tmp) == IS_LONG) {
tmp = Z_CLIENT_USE_PROXY_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_LONG) {
use_proxy = Z_LVAL_P(tmp);
}
} else {
@@ -431,8 +438,8 @@ int make_http_soap_request(zval *this_ptr,
phpurl = php_url_parse(location);
}
if (NULL != (tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr),
"_stream_context", sizeof("_stream_context")-1))) {
tmp = Z_CLIENT_STREAM_CONTEXT_P(this_ptr);
if (Z_TYPE_P(tmp) == IS_RESOURCE) {
context = php_stream_context_from_zval(tmp, 0);
}
@@ -501,7 +508,7 @@ try_again:
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr));
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
stream = NULL;
use_proxy = 0;
}
@@ -512,7 +519,7 @@ try_again:
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr));
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
stream = NULL;
use_proxy = 0;
}
@@ -523,7 +530,7 @@ try_again:
php_stream_auto_cleanup(stream);
ZVAL_RES(Z_CLIENT_HTTPSOCKET_P(this_ptr), stream->res);
GC_ADDREF(stream->res);
add_property_long(this_ptr, "_use_proxy", use_proxy);
ZVAL_LONG(Z_CLIENT_USE_PROXY_P(this_ptr), use_proxy);
} else {
php_url_free(phpurl);
if (request != buf) {
@@ -584,17 +591,18 @@ try_again:
smart_str_appendc(&soap_headers, ':');
smart_str_append_unsigned(&soap_headers, phpurl->port);
}
if (!http_1_1 ||
((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_keep_alive", sizeof("_keep_alive")-1)) != NULL &&
(Z_TYPE_P(tmp) == IS_FALSE || (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0)))) {
tmp = Z_CLIENT_KEEP_ALIVE_P(this_ptr);
ZVAL_DEREF(tmp);
if (!http_1_1 || Z_TYPE_P(tmp) == IS_FALSE) {
smart_str_append_const(&soap_headers, "\r\n"
"Connection: close\r\n");
} else {
smart_str_append_const(&soap_headers, "\r\n"
"Connection: Keep-Alive\r\n");
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
tmp = Z_CLIENT_USER_AGENT_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_STRING) {
if (Z_STRLEN_P(tmp) > 0) {
smart_str_append_const(&soap_headers, "User-Agent: ");
smart_str_appendl(&soap_headers, Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
@@ -658,12 +666,14 @@ try_again:
smart_str_append_const(&soap_headers, "\r\n");
/* HTTP Authentication */
if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL &&
Z_TYPE_P(login) == IS_STRING) {
zval *digest;
login = Z_CLIENT_LOGIN_P(this_ptr);
ZVAL_DEREF(login);
if (Z_TYPE_P(login) == IS_STRING) {
zval *digest = Z_CLIENT_DIGEST_P(this_ptr);
ZVAL_DEREF(digest);
has_authorization = 1;
if ((digest = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) != NULL && Z_TYPE_P(digest) == IS_ARRAY) {
if (Z_TYPE_P(digest) == IS_ARRAY) {
char HA1[33], HA2[33], response[33], cnonce[33], nc[9];
zend_long nonce;
PHP_MD5_CTX md5ctx;
@@ -695,8 +705,9 @@ try_again:
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(tmp), Z_STRLEN_P(tmp));
}
PHP_MD5Update(&md5ctx, (unsigned char*)":", 1);
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
Z_TYPE_P(password) == IS_STRING) {
password = Z_CLIENT_PASSWORD_P(this_ptr);
ZVAL_DEREF(password);
if (Z_TYPE_P(password) == IS_STRING) {
PHP_MD5Update(&md5ctx, (unsigned char*)Z_STRVAL_P(password), Z_STRLEN_P(password));
}
PHP_MD5Final(hash, &md5ctx);
@@ -807,16 +818,17 @@ try_again:
zend_string *buf;
smart_str auth = {0};
smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login));
smart_str_append(&auth, Z_STR_P(login));
smart_str_appendc(&auth, ':');
if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
Z_TYPE_P(password) == IS_STRING) {
smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password));
password = Z_CLIENT_PASSWORD_P(this_ptr);
ZVAL_DEREF(password);
if (Z_TYPE_P(password) == IS_STRING) {
smart_str_append(&auth, Z_STR_P(password));
}
smart_str_0(&auth);
buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s));
smart_str_append_const(&soap_headers, "Authorization: Basic ");
smart_str_appendl(&soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf));
smart_str_append(&soap_headers, buf);
smart_str_append_const(&soap_headers, "\r\n");
zend_string_release_ex(buf, 0);
smart_str_free(&auth);
@@ -829,8 +841,9 @@ try_again:
}
/* Send cookies along with request */
if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL &&
Z_TYPE_P(cookies) == IS_ARRAY) {
cookies = Z_CLIENT_COOKIES_P(this_ptr);
ZVAL_DEREF(cookies);
if (Z_TYPE_P(cookies) == IS_ARRAY) {
zval *data;
zend_string *key;
uint32_t n = zend_hash_num_elements(Z_ARRVAL_P(cookies));
@@ -870,7 +883,8 @@ try_again:
trace = Z_CLIENT_TRACE_P(this_ptr);
ZVAL_DEREF(trace);
if (Z_TYPE_P(trace) == IS_TRUE) {
add_property_stringl(this_ptr, "__last_request_headers", ZSTR_VAL(soap_headers.s), ZSTR_LEN(soap_headers.s));
zval_ptr_dtor(Z_CLIENT_LAST_REQUEST_HEADERS_P(this_ptr));
ZVAL_STR_COPY(Z_CLIENT_LAST_REQUEST_HEADERS_P(this_ptr), soap_headers.s);
}
smart_str_appendl(&soap_headers, request->val, request->len);
smart_str_0(&soap_headers);
@@ -883,7 +897,7 @@ try_again:
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPURL_P(this_ptr));
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Failed Sending HTTP SOAP request", NULL, NULL);
smart_str_free(&soap_headers_z);
return FALSE;
@@ -898,7 +912,7 @@ try_again:
if (!return_value) {
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
smart_str_free(&soap_headers_z);
return TRUE;
}
@@ -911,7 +925,7 @@ try_again:
}
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Error Fetching http headers", NULL, NULL);
smart_str_free(&soap_headers_z);
return FALSE;
@@ -920,7 +934,8 @@ try_again:
trace = Z_CLIENT_TRACE_P(this_ptr);
ZVAL_DEREF(trace);
if (Z_TYPE_P(trace) == IS_TRUE) {
add_property_str(this_ptr, "__last_response_headers", zend_string_copy(http_headers));
zval_ptr_dtor(Z_CLIENT_LAST_RESPONSE_HEADERS_P(this_ptr));
ZVAL_STR_COPY(Z_CLIENT_LAST_RESPONSE_HEADERS_P(this_ptr), http_headers);
}
/* Check to see what HTTP status was sent */
@@ -967,13 +982,10 @@ try_again:
while ((cookie_itt = get_http_header_value_nodup(cookie_itt, "Set-Cookie: ", &cookie_len))) {
char *cookie;
char *eqpos, *sempos;
zval *cookies;
if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL ||
Z_TYPE_P(cookies) != IS_ARRAY) {
zval tmp_cookies;
array_init(&tmp_cookies);
cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies);
zval *cookies = Z_CLIENT_COOKIES_P(this_ptr);
ZVAL_DEREF(cookies);
if (Z_TYPE_P(cookies) != IS_ARRAY) {
array_init(cookies);
}
cookie = estrndup(cookie_itt, cookie_len);
@@ -1090,7 +1102,7 @@ try_again:
php_stream_close(stream);
zend_string_release_ex(http_headers, 0);
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
add_soap_fault(this_ptr, "HTTP", "Error Fetching http body, No Content-Length, connection closed or chunked data", NULL, NULL);
if (http_msg) {
efree(http_msg);
@@ -1106,7 +1118,7 @@ try_again:
if (http_close) {
php_stream_close(stream);
convert_to_null(Z_CLIENT_HTTPSOCKET_P(this_ptr));
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "_use_proxy", sizeof("_use_proxy")-1);
convert_to_null(Z_CLIENT_USE_PROXY_P(this_ptr));
stream = NULL;
}
@@ -1160,17 +1172,15 @@ try_again:
}
} else if (http_status == 401) {
/* Digest authentication */
zval *digest, *login, *password;
zval *digest = Z_CLIENT_DIGEST_P(this_ptr);
zval *login = Z_CLIENT_LOGIN_P(this_ptr);
zval *password = Z_CLIENT_PASSWORD_P(this_ptr);
char *auth = get_http_header_value(ZSTR_VAL(http_headers), "WWW-Authenticate: ");
if (auth &&
strstr(auth, "Digest") == auth &&
((digest = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_digest", sizeof("_digest")-1)) == NULL ||
Z_TYPE_P(digest) != IS_ARRAY) &&
(login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_login", sizeof("_login")-1)) != NULL &&
Z_TYPE_P(login) == IS_STRING &&
(password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_password", sizeof("_password")-1)) != NULL &&
Z_TYPE_P(password) == IS_STRING) {
ZVAL_DEREF(digest);
ZVAL_DEREF(login);
ZVAL_DEREF(password);
if (auth && strstr(auth, "Digest") == auth && Z_TYPE_P(digest) != IS_ARRAY
&& Z_TYPE_P(login) == IS_STRING && Z_TYPE_P(password) == IS_STRING) {
char *s;
zval digest;
@@ -1211,10 +1221,10 @@ try_again:
}
if (Z_TYPE(digest) != IS_UNDEF) {
php_url *new_url = emalloc(sizeof(php_url));
php_url *new_url = emalloc(sizeof(php_url));
Z_DELREF(digest);
add_property_zval_ex(this_ptr, "_digest", sizeof("_digest")-1, &digest);
zval_ptr_dtor(Z_CLIENT_DIGEST_P(this_ptr));
ZVAL_COPY_VALUE(Z_CLIENT_DIGEST_P(this_ptr), &digest);
*new_url = *phpurl;
if (phpurl->scheme) phpurl->scheme = zend_string_copy(phpurl->scheme);

View File

@@ -3163,7 +3163,7 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
char* old_error_code = SOAP_GLOBAL(error_code);
size_t uri_len = 0;
php_stream_context *context=NULL;
zval *tmp, *proxy_host, *proxy_port, orig_context, new_context;
zval *tmp, orig_context, new_context;
smart_str headers = {0};
char* key = NULL;
time_t t = time(0);
@@ -3237,50 +3237,56 @@ sdlPtr get_sdl(zval *this_ptr, char *uri, zend_long cache_wsdl)
}
}
if (NULL != (tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr),
"_stream_context", sizeof("_stream_context")-1))) {
context = php_stream_context_from_zval(tmp, 0);
} else {
if (instanceof_function(Z_OBJCE_P(this_ptr), soap_class_entry)) {
tmp = Z_CLIENT_STREAM_CONTEXT_P(this_ptr);
if (Z_TYPE_P(tmp) == IS_RESOURCE) {
context = php_stream_context_from_zval(tmp, 0);
}
tmp = Z_CLIENT_USER_AGENT_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) {
smart_str_appends(&headers, "User-Agent: ");
smart_str_appends(&headers, Z_STRVAL_P(tmp));
smart_str_appends(&headers, "\r\n");
}
zval *proxy_host = Z_CLIENT_PROXY_HOST_P(this_ptr);
zval *proxy_port = Z_CLIENT_PROXY_PORT_P(this_ptr);
ZVAL_DEREF(proxy_host);
ZVAL_DEREF(proxy_port);
if (Z_TYPE_P(proxy_host) == IS_STRING && Z_TYPE_P(proxy_port) == IS_LONG) {
zval str_proxy;
smart_str proxy = {0};
smart_str_appends(&proxy,"tcp://");
smart_str_appends(&proxy,Z_STRVAL_P(proxy_host));
smart_str_appends(&proxy,":");
smart_str_append_long(&proxy,Z_LVAL_P(proxy_port));
smart_str_0(&proxy);
ZVAL_NEW_STR(&str_proxy, proxy.s);
if (!context) {
context = php_stream_context_alloc();
}
php_stream_context_set_option(context, "http", "proxy", &str_proxy);
zval_ptr_dtor(&str_proxy);
if (uri_len < sizeof("https://")-1 ||
strncasecmp(uri, "https://", sizeof("https://")-1) != 0) {
ZVAL_TRUE(&str_proxy);
php_stream_context_set_option(context, "http", "request_fulluri", &str_proxy);
}
has_proxy_authorization = proxy_authentication(this_ptr, &headers);
}
has_authorization = basic_authentication(this_ptr, &headers);
}
if (!context) {
context = php_stream_context_alloc();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_user_agent", sizeof("_user_agent")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING && Z_STRLEN_P(tmp) > 0) {
smart_str_appends(&headers, "User-Agent: ");
smart_str_appends(&headers, Z_STRVAL_P(tmp));
smart_str_appends(&headers, "\r\n");
}
if ((proxy_host = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host")-1)) != NULL &&
Z_TYPE_P(proxy_host) == IS_STRING &&
(proxy_port = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port")-1)) != NULL &&
Z_TYPE_P(proxy_port) == IS_LONG) {
zval str_proxy;
smart_str proxy = {0};
smart_str_appends(&proxy,"tcp://");
smart_str_appends(&proxy,Z_STRVAL_P(proxy_host));
smart_str_appends(&proxy,":");
smart_str_append_long(&proxy,Z_LVAL_P(proxy_port));
smart_str_0(&proxy);
ZVAL_NEW_STR(&str_proxy, proxy.s);
if (!context) {
context = php_stream_context_alloc();
}
php_stream_context_set_option(context, "http", "proxy", &str_proxy);
zval_ptr_dtor(&str_proxy);
if (uri_len < sizeof("https://")-1 ||
strncasecmp(uri, "https://", sizeof("https://")-1) != 0) {
ZVAL_TRUE(&str_proxy);
php_stream_context_set_option(context, "http", "request_fulluri", &str_proxy);
}
has_proxy_authorization = proxy_authentication(this_ptr, &headers);
}
has_authorization = basic_authentication(this_ptr, &headers);
/* Use HTTP/1.1 with "Connection: close" by default */
if ((tmp = php_stream_context_get_option(context, "http", "protocol_version")) == NULL) {
zval http_version;

View File

@@ -192,6 +192,7 @@ ZEND_EXTERN_MODULE_GLOBALS(soap)
ZEND_TSRMLS_CACHE_EXTERN()
#endif
extern zend_class_entry* soap_class_entry;
extern zend_class_entry* soap_var_class_entry;
void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail);
@@ -218,5 +219,31 @@ void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault
#define Z_CLIENT_TYPEMAP_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 7)
#define Z_CLIENT_HTTPSOCKET_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 8)
#define Z_CLIENT_HTTPURL_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 9)
#define Z_CLIENT_LOGIN_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 10)
#define Z_CLIENT_PASSWORD_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 11)
#define Z_CLIENT_USE_DIGEST_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 12)
#define Z_CLIENT_DIGEST_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 13)
#define Z_CLIENT_PROXY_HOST_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 14)
#define Z_CLIENT_PROXY_PORT_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 15)
#define Z_CLIENT_PROXY_LOGIN_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 16)
#define Z_CLIENT_PROXY_PASSWORD_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 17)
#define Z_CLIENT_EXCEPTIONS_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 18)
#define Z_CLIENT_ENCODING_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 19)
#define Z_CLIENT_CLASSMAP_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 20)
#define Z_CLIENT_FEATURES_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 21)
#define Z_CLIENT_CONNECTION_TIMEOUT_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 22)
#define Z_CLIENT_STREAM_CONTEXT_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 23)
#define Z_CLIENT_USER_AGENT_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 24)
#define Z_CLIENT_KEEP_ALIVE_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 25)
#define Z_CLIENT_SSL_METHOD_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 26)
#define Z_CLIENT_SOAP_VERSION_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 27)
#define Z_CLIENT_USE_PROXY_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 28)
#define Z_CLIENT_COOKIES_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 29)
#define Z_CLIENT_DEFAULT_HEADERS_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 30)
#define Z_CLIENT_SOAP_FAULT_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 31)
#define Z_CLIENT_LAST_REQUEST_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 32)
#define Z_CLIENT_LAST_RESPONSE_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 33)
#define Z_CLIENT_LAST_REQUEST_HEADERS_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 34)
#define Z_CLIENT_LAST_RESPONSE_HEADERS_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 35)
#endif

View File

@@ -151,6 +151,7 @@ static void soap_error_handler(int error_num, zend_string *error_filename, const
#define Z_HEADER_ACTOR_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 4)
#define Z_SERVER_SERVICE_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 0)
#define Z_SERVER_SOAP_FAULT_P(zv) OBJ_PROP_NUM(Z_OBJ_P(zv), 1)
/* SoapFault extends Exception, so take those properties into account. */
#define FAULT_PROP_START_OFFSET zend_ce_exception->default_properties_count
@@ -173,7 +174,7 @@ static void soap_error_handler(int error_num, zend_string *error_filename, const
} \
}
static zend_class_entry* soap_class_entry;
zend_class_entry* soap_class_entry;
static zend_class_entry* soap_server_class_entry;
static zend_class_entry* soap_fault_class_entry;
static zend_class_entry* soap_header_class_entry;
@@ -1784,14 +1785,9 @@ static zend_never_inline ZEND_COLD void soap_real_error_handler(int error_num, z
if (Z_OBJ(SOAP_GLOBAL(error_object)) &&
instanceof_function(Z_OBJCE(SOAP_GLOBAL(error_object)), soap_class_entry)) {
zval *tmp;
int use_exceptions = 0;
if ((tmp = zend_hash_str_find(Z_OBJPROP(SOAP_GLOBAL(error_object)), "_exceptions", sizeof("_exceptions")-1)) == NULL ||
Z_TYPE_P(tmp) != IS_FALSE) {
use_exceptions = 1;
}
zval *tmp = Z_CLIENT_EXCEPTIONS_P(&SOAP_GLOBAL(error_object));
ZVAL_DEREF(tmp);
bool use_exceptions = Z_TYPE_P(tmp) != IS_FALSE;
if ((error_num & E_FATAL_ERRORS) && use_exceptions) {
zval fault;
char *code = SOAP_GLOBAL(error_code);
@@ -1978,33 +1974,33 @@ PHP_METHOD(SoapClient, __construct)
}
if ((tmp = zend_hash_str_find(ht, "login", sizeof("login")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
add_property_str(this_ptr, "_login", zend_string_copy(Z_STR_P(tmp)));
ZVAL_STR_COPY(Z_CLIENT_LOGIN_P(this_ptr), Z_STR_P(tmp));
if ((tmp = zend_hash_str_find(ht, "password", sizeof("password")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
add_property_str(this_ptr, "_password", zend_string_copy(Z_STR_P(tmp)));
ZVAL_STR_COPY(Z_CLIENT_PASSWORD_P(this_ptr), Z_STR_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "authentication", sizeof("authentication")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG &&
Z_LVAL_P(tmp) == SOAP_AUTHENTICATION_DIGEST) {
add_property_bool(this_ptr, "_use_digest", true);
ZVAL_TRUE(Z_CLIENT_USE_DIGEST_P(this_ptr));
}
}
if ((tmp = zend_hash_str_find(ht, "proxy_host", sizeof("proxy_host")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
add_property_str(this_ptr, "_proxy_host", zend_string_copy(Z_STR_P(tmp)));
ZVAL_STR_COPY(Z_CLIENT_PROXY_HOST_P(this_ptr), Z_STR_P(tmp));
if ((tmp = zend_hash_str_find(ht, "proxy_port", sizeof("proxy_port")-1)) != NULL) {
if (Z_TYPE_P(tmp) != IS_LONG) {
ZVAL_LONG(&tmp2, zval_get_long(tmp));
tmp = &tmp2;
}
add_property_long(this_ptr, "_proxy_port", Z_LVAL_P(tmp));
ZVAL_LONG(Z_CLIENT_PROXY_PORT_P(this_ptr), Z_LVAL_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "proxy_login", sizeof("proxy_login")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
add_property_str(this_ptr, "_proxy_login", zend_string_copy(Z_STR_P(tmp)));
ZVAL_STR_COPY(Z_CLIENT_PROXY_LOGIN_P(this_ptr), Z_STR_P(tmp));
if ((tmp = zend_hash_str_find(ht, "proxy_password", sizeof("proxy_password")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
add_property_str(this_ptr, "_proxy_password", zend_string_copy(Z_STR_P(tmp)));
ZVAL_STR_COPY(Z_CLIENT_PROXY_PASSWORD_P(this_ptr), Z_STR_P(tmp));
}
}
}
@@ -2028,7 +2024,7 @@ PHP_METHOD(SoapClient, __construct)
if ((tmp = zend_hash_str_find(ht, "exceptions", sizeof("exceptions")-1)) != NULL &&
(Z_TYPE_P(tmp) == IS_FALSE ||
(Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) {
add_property_bool(this_ptr, "_exceptions", 0);
ZVAL_FALSE(Z_CLIENT_EXCEPTIONS_P(this_ptr));
}
if ((tmp = zend_hash_str_find(ht, "compression", sizeof("compression")-1)) != NULL &&
@@ -2049,12 +2045,12 @@ PHP_METHOD(SoapClient, __construct)
php_error_docref(NULL, E_ERROR, "Invalid 'encoding' option - '%s'", Z_STRVAL_P(tmp));
} else {
xmlCharEncCloseFunc(encoding);
add_property_str(this_ptr, "_encoding", zend_string_copy(Z_STR_P(tmp)));
ZVAL_STR_COPY(Z_CLIENT_ENCODING_P(this_ptr), Z_STR_P(tmp));
}
}
if ((tmp = zend_hash_str_find(ht, "classmap", sizeof("classmap")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_ARRAY) {
add_property_zval(this_ptr, "_classmap", tmp);
ZVAL_COPY(Z_CLIENT_CLASSMAP_P(this_ptr), tmp);
}
if ((tmp = zend_hash_str_find(ht, "typemap", sizeof("typemap")-1)) != NULL &&
@@ -2065,21 +2061,18 @@ PHP_METHOD(SoapClient, __construct)
if ((tmp = zend_hash_str_find(ht, "features", sizeof("features")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG) {
add_property_long(this_ptr, "_features", Z_LVAL_P(tmp));
ZVAL_LONG(Z_CLIENT_FEATURES_P(this_ptr), Z_LVAL_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "connection_timeout", sizeof("connection_timeout")-1)) != NULL) {
if (Z_TYPE_P(tmp) != IS_LONG) {
ZVAL_LONG(&tmp2, zval_get_long(tmp));
tmp = &tmp2;
}
if (Z_LVAL_P(tmp) > 0) {
add_property_long(this_ptr, "_connection_timeout", Z_LVAL_P(tmp));
zend_long lval = zval_get_long(tmp);
if (lval > 0) {
ZVAL_LONG(Z_CLIENT_CONNECTION_TIMEOUT_P(this_ptr), lval);
}
}
if (context) {
add_property_resource(this_ptr, "_stream_context", context->res);
ZVAL_RES(Z_CLIENT_STREAM_CONTEXT_P(this_ptr), context->res);
}
if ((tmp = zend_hash_str_find(ht, "cache_wsdl", sizeof("cache_wsdl")-1)) != NULL &&
@@ -2089,18 +2082,18 @@ PHP_METHOD(SoapClient, __construct)
if ((tmp = zend_hash_str_find(ht, "user_agent", sizeof("user_agent")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
add_property_str(this_ptr, "_user_agent", zend_string_copy(Z_STR_P(tmp)));
ZVAL_STR_COPY(Z_CLIENT_USER_AGENT_P(this_ptr), Z_STR_P(tmp));
}
if ((tmp = zend_hash_str_find(ht, "keep_alive", sizeof("keep_alive")-1)) != NULL &&
(Z_TYPE_P(tmp) == IS_FALSE ||
(Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == 0))) {
add_property_long(this_ptr, "_keep_alive", 0);
ZVAL_FALSE(Z_CLIENT_KEEP_ALIVE_P(this_ptr));
}
if ((tmp = zend_hash_str_find(ht, "ssl_method", sizeof("ssl_method")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG) {
add_property_long(this_ptr, "_ssl_method", Z_LVAL_P(tmp));
ZVAL_LONG(Z_CLIENT_SSL_METHOD_P(this_ptr), Z_LVAL_P(tmp));
php_error_docref(NULL, E_DEPRECATED,
"The \"ssl_method\" option is deprecated. "
"Use \"ssl\" stream context options instead");
@@ -2109,7 +2102,7 @@ PHP_METHOD(SoapClient, __construct)
php_error_docref(NULL, E_ERROR, "'location' and 'uri' options are required in nonWSDL mode");
}
add_property_long(this_ptr, "_soap_version", soap_version);
ZVAL_LONG(Z_CLIENT_SOAP_VERSION_P(this_ptr), soap_version);
if (wsdl) {
int old_soap_version;
@@ -2144,7 +2137,6 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
int buf_size;
zval func;
zval params[5];
zval *fault;
int _bailout = 0;
ZVAL_NULL(response);
@@ -2159,7 +2151,8 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
zval *trace = Z_CLIENT_TRACE_P(this_ptr);
ZVAL_DEREF(trace);
if (Z_TYPE_P(trace) == IS_TRUE) {
add_property_stringl(this_ptr, "__last_request", buf, buf_size);
zval_ptr_dtor(Z_CLIENT_LAST_REQUEST_P(this_ptr));
ZVAL_STRINGL(Z_CLIENT_LAST_REQUEST_P(this_ptr), buf, buf_size);
}
ZVAL_STRINGL(&func,"__doRequest",sizeof("__doRequest")-1);
@@ -2179,12 +2172,13 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
} else if (Z_TYPE_P(response) != IS_STRING) {
if (EG(exception) && instanceof_function(EG(exception)->ce, zend_ce_error)) {
/* Programmer error in __doRequest() implementation, let it bubble up. */
} else if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) == NULL) {
} else if (Z_TYPE_P(Z_CLIENT_SOAP_FAULT_P(this_ptr)) != IS_OBJECT) {
add_soap_fault(this_ptr, "Client", "SoapClient::__doRequest() returned non string value", NULL, NULL);
}
ret = FALSE;
} else if (Z_TYPE_P(trace) == IS_TRUE) {
add_property_str(this_ptr, "__last_response", zend_string_copy(Z_STR_P(response)));
zval_ptr_dtor(Z_CLIENT_LAST_RESPONSE_P(this_ptr));
ZVAL_STR_COPY(Z_CLIENT_LAST_RESPONSE_P(this_ptr), Z_STR_P(response));
}
} zend_catch {
_bailout = 1;
@@ -2197,7 +2191,7 @@ static int do_request(zval *this_ptr, xmlDoc *request, char *location, char *act
if (_bailout) {
zend_bailout();
}
if (ret && (fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) != NULL) {
if (ret && Z_TYPE_P(Z_CLIENT_SOAP_FAULT_P(this_ptr)) == IS_OBJECT) {
ret = FALSE;
}
return ret;
@@ -2239,11 +2233,12 @@ static void do_soap_call(zend_execute_data *execute_data,
trace = Z_CLIENT_TRACE_P(this_ptr);
ZVAL_DEREF(trace);
if (Z_TYPE_P(trace) == IS_TRUE) {
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_request", sizeof("__last_request")-1);
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__last_response", sizeof("__last_response")-1);
convert_to_null(Z_CLIENT_LAST_REQUEST_P(this_ptr));
convert_to_null(Z_CLIENT_LAST_RESPONSE_P(this_ptr));
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_soap_version", sizeof("_soap_version")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == SOAP_1_2) {
tmp = Z_CLIENT_SOAP_VERSION_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_LONG && Z_LVAL_P(tmp) == SOAP_1_2) {
soap_version = SOAP_1_2;
} else {
soap_version = SOAP_1_1;
@@ -2273,15 +2268,17 @@ static void do_soap_call(zend_execute_data *execute_data,
old_sdl = SOAP_GLOBAL(sdl);
SOAP_GLOBAL(sdl) = sdl;
old_encoding = SOAP_GLOBAL(encoding);
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_encoding", sizeof("_encoding")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
tmp = Z_CLIENT_ENCODING_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_STRING) {
SOAP_GLOBAL(encoding) = xmlFindCharEncodingHandler(Z_STRVAL_P(tmp));
} else {
SOAP_GLOBAL(encoding) = NULL;
}
old_class_map = SOAP_GLOBAL(class_map);
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_classmap", sizeof("_classmap")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_ARRAY) {
tmp = Z_CLIENT_CLASSMAP_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_ARRAY) {
SOAP_GLOBAL(class_map) = Z_ARRVAL_P(tmp);
} else {
SOAP_GLOBAL(class_map) = NULL;
@@ -2289,8 +2286,9 @@ static void do_soap_call(zend_execute_data *execute_data,
old_typemap = SOAP_GLOBAL(typemap);
SOAP_GLOBAL(typemap) = typemap;
old_features = SOAP_GLOBAL(features);
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_features", sizeof("_features")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG) {
tmp = Z_CLIENT_FEATURES_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_LONG) {
SOAP_GLOBAL(features) = Z_LVAL_P(tmp);
} else {
SOAP_GLOBAL(features) = 0;
@@ -2380,17 +2378,16 @@ static void do_soap_call(zend_execute_data *execute_data,
}
}
zval *fault = Z_CLIENT_SOAP_FAULT_P(this_ptr);
if (!ret) {
zval* fault;
if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) != NULL) {
if (Z_TYPE_P(fault) == IS_OBJECT) {
ZVAL_COPY(return_value, fault);
} else {
add_soap_fault_ex(return_value, this_ptr, "Client", "Unknown Error", NULL, NULL);
Z_ADDREF_P(return_value);
}
} else {
zval* fault;
if ((fault = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__soap_fault", sizeof("__soap_fault")-1)) != NULL) {
if (Z_TYPE_P(fault) == IS_OBJECT) {
ZVAL_COPY(return_value, fault);
}
}
@@ -2398,8 +2395,7 @@ static void do_soap_call(zend_execute_data *execute_data,
if (!EG(exception) &&
Z_TYPE_P(return_value) == IS_OBJECT &&
instanceof_function(Z_OBJCE_P(return_value), soap_fault_class_entry) &&
((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_exceptions", sizeof("_exceptions")-1)) == NULL ||
Z_TYPE_P(tmp) != IS_FALSE)) {
Z_TYPE_P(Z_CLIENT_EXCEPTIONS_P(this_ptr)) != IS_FALSE) {
Z_ADDREF_P(return_value);
zend_throw_exception_object(return_value);
}
@@ -2506,7 +2502,9 @@ void soap_client_call_impl(INTERNAL_FUNCTION_PARAMETERS, bool is_soap_call)
/* Add default headers */
this_ptr = ZEND_THIS;
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1)) != NULL && Z_TYPE_P(tmp) == IS_ARRAY) {
tmp = Z_CLIENT_DEFAULT_HEADERS_P(this_ptr);
ZVAL_DEREF(tmp);
if (Z_TYPE_P(tmp) == IS_ARRAY) {
HashTable *default_headers = Z_ARRVAL_P(tmp);
if (soap_headers) {
if (!free_soap_headers) {
@@ -2623,17 +2621,11 @@ PHP_METHOD(SoapClient, __getTypes)
/* {{{ Returns last SOAP request */
PHP_METHOD(SoapClient, __getLastRequest)
{
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request", sizeof("__last_request")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
RETURN_COPY_DEREF(Z_CLIENT_LAST_REQUEST_P(ZEND_THIS));
}
/* }}} */
@@ -2641,17 +2633,11 @@ PHP_METHOD(SoapClient, __getLastRequest)
/* {{{ Returns last SOAP response */
PHP_METHOD(SoapClient, __getLastResponse)
{
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response", sizeof("__last_response")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
RETURN_COPY_DEREF(Z_CLIENT_LAST_RESPONSE_P(ZEND_THIS));
}
/* }}} */
@@ -2659,17 +2645,11 @@ PHP_METHOD(SoapClient, __getLastResponse)
/* {{{ Returns last SOAP request headers */
PHP_METHOD(SoapClient, __getLastRequestHeaders)
{
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_request_headers", sizeof("__last_request_headers")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
RETURN_COPY_DEREF(Z_CLIENT_LAST_REQUEST_HEADERS_P(ZEND_THIS));
}
/* }}} */
@@ -2677,17 +2657,11 @@ PHP_METHOD(SoapClient, __getLastRequestHeaders)
/* {{{ Returns last SOAP response headers */
PHP_METHOD(SoapClient, __getLastResponseHeaders)
{
zval *tmp;
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
if ((tmp = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "__last_response_headers", sizeof("__last_response_headers")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_STRING) {
RETURN_STR_COPY(Z_STR_P(tmp));
}
RETURN_NULL();
RETURN_COPY_DEREF(Z_CLIENT_LAST_RESPONSE_HEADERS_P(ZEND_THIS));
}
/* }}} */
@@ -2729,35 +2703,29 @@ PHP_METHOD(SoapClient, __doRequest)
If value is not specified cookie is removed. */
PHP_METHOD(SoapClient, __setCookie)
{
char *name;
char *val = NULL;
size_t name_len, val_len = 0;
zval *cookies;
zend_string *name, *val = NULL;
zval *this_ptr = ZEND_THIS;
if (zend_parse_parameters(ZEND_NUM_ARGS(), "s|s!", &name, &name_len, &val, &val_len) == FAILURE) {
if (zend_parse_parameters(ZEND_NUM_ARGS(), "S|S!", &name, &val) == FAILURE) {
RETURN_THROWS();
}
zval *cookies = Z_CLIENT_COOKIES_P(this_ptr);
ZVAL_DEREF(cookies);
if (val == NULL) {
if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) != NULL &&
Z_TYPE_P(cookies) == IS_ARRAY) {
zend_hash_str_del(Z_ARRVAL_P(cookies), name, name_len);
if (Z_TYPE_P(cookies) == IS_ARRAY) {
zend_hash_del(Z_ARRVAL_P(cookies), name);
}
} else {
zval zcookie;
if ((cookies = zend_hash_str_find(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1)) == NULL ||
Z_TYPE_P(cookies) != IS_ARRAY) {
zval tmp_cookies;
array_init(&tmp_cookies);
cookies = zend_hash_str_update(Z_OBJPROP_P(this_ptr), "_cookies", sizeof("_cookies")-1, &tmp_cookies);
if (Z_TYPE_P(cookies) != IS_ARRAY) {
array_init(cookies);
}
zval zcookie;
array_init(&zcookie);
add_index_stringl(&zcookie, 0, val, val_len);
add_assoc_zval_ex(cookies, name, name_len, &zcookie);
add_index_str(&zcookie, 0, zend_string_copy(val));
zend_hash_update(Z_ARRVAL_P(cookies), name, &zcookie);
}
}
/* }}} */
@@ -2765,15 +2733,13 @@ PHP_METHOD(SoapClient, __setCookie)
/* {{{ Returns list of cookies */
PHP_METHOD(SoapClient, __getCookies)
{
zval *cookies;
if (zend_parse_parameters_none() == FAILURE) {
RETURN_THROWS();
}
if ((cookies = zend_hash_str_find(Z_OBJPROP_P(ZEND_THIS), "_cookies", sizeof("_cookies")-1)) != NULL &&
Z_TYPE_P(cookies) == IS_ARRAY) {
zval *cookies = Z_CLIENT_COOKIES_P(ZEND_THIS);
ZVAL_DEREF(cookies);
if (Z_TYPE_P(cookies) == IS_ARRAY) {
RETURN_ARR(zend_array_dup(Z_ARRVAL_P(cookies)));
} else {
array_init(return_value);
@@ -2794,19 +2760,20 @@ PHP_METHOD(SoapClient, __setSoapHeaders)
}
if (headers == NULL || Z_TYPE_P(headers) == IS_NULL) {
zend_hash_str_del(Z_OBJPROP_P(this_ptr), "__default_headers", sizeof("__default_headers")-1);
convert_to_null(Z_CLIENT_DEFAULT_HEADERS_P(this_ptr));
} else if (Z_TYPE_P(headers) == IS_ARRAY) {
verify_soap_headers_array(Z_ARRVAL_P(headers));
add_property_zval(this_ptr, "__default_headers", headers);
zval_ptr_dtor(Z_CLIENT_DEFAULT_HEADERS_P(this_ptr));
ZVAL_COPY(Z_CLIENT_DEFAULT_HEADERS_P(this_ptr), headers);
} else if (Z_TYPE_P(headers) == IS_OBJECT &&
instanceof_function(Z_OBJCE_P(headers), soap_header_class_entry)) {
zval default_headers;
array_init(&default_headers);
Z_ADDREF_P(headers);
add_next_index_zval(&default_headers, headers);
add_property_zval(this_ptr, "__default_headers", &default_headers);
Z_DELREF_P(&default_headers);
zval_ptr_dtor(Z_CLIENT_DEFAULT_HEADERS_P(this_ptr));
ZVAL_COPY_VALUE(Z_CLIENT_DEFAULT_HEADERS_P(this_ptr), &default_headers);
} else {
zend_argument_type_error(1, "must be of type SoapHeader|array|null, %s given", zend_zval_type_name(headers));
RETURN_THROWS();
@@ -2841,9 +2808,8 @@ PHP_METHOD(SoapClient, __setLocation)
static void clear_soap_fault(zval *obj) /* {{{ */
{
if (obj != NULL && Z_TYPE_P(obj) == IS_OBJECT) {
zend_hash_str_del(Z_OBJPROP_P(obj), "__soap_fault", sizeof("__soap_fault")-1);
}
ZEND_ASSERT(instanceof_function(Z_OBJCE_P(obj), soap_class_entry));
convert_to_null(Z_CLIENT_SOAP_FAULT_P(obj));
}
/* }}} */
@@ -2851,19 +2817,23 @@ static void add_soap_fault_ex(zval *fault, zval *obj, char *fault_code, char *fa
{
ZVAL_NULL(fault);
set_soap_fault(fault, NULL, fault_code, fault_string, fault_actor, fault_detail, NULL);
add_property_zval(obj, "__soap_fault", fault);
Z_DELREF_P(fault);
zval *target;
if (instanceof_function(Z_OBJCE_P(obj), soap_class_entry)) {
target = Z_CLIENT_SOAP_FAULT_P(obj);
} else if (instanceof_function(Z_OBJCE_P(obj), soap_server_class_entry)) {
target = Z_SERVER_SOAP_FAULT_P(obj);
} else {
ZEND_UNREACHABLE();
}
zval_ptr_dtor(target);
ZVAL_COPY_VALUE(target, fault);
}
/* }}} */
void add_soap_fault(zval *obj, char *fault_code, char *fault_string, char *fault_actor, zval *fault_detail) /* {{{ */
{
zval fault;
ZVAL_NULL(&fault);
set_soap_fault(&fault, NULL, fault_code, fault_string, fault_actor, fault_detail, NULL);
add_property_zval(obj, "__soap_fault", &fault);
Z_DELREF(fault);
add_soap_fault_ex(&fault, obj, fault_code, fault_string, fault_actor, fault_detail);
}
/* }}} */

View File

@@ -57,6 +57,8 @@ class SoapServer
/** @var resource */
public $service;
public ?SoapFault $__soap_fault = null;
public function __construct(?string $wsdl, array $options = []) {}
/** @tentative-return-type */
@@ -104,6 +106,34 @@ class SoapClient
/** @var resource|null */
public $httpurl = null;
public ?string $_login = null;
public ?string $_password = null;
public bool $_use_digest = false;
public ?string $_digest = null;
public ?string $_proxy_host = null;
public ?int $_proxy_port = null;
public ?string $_proxy_login = null;
public ?string $_proxy_password = null;
public bool $_exceptions = true;
public ?string $_encoding = null;
public ?array $_classmap = null;
public ?int $_features = null;
public int $_connection_timeout = 0;
/** @var resource|null */
public $_stream_context = null;
public ?string $_user_agent = null;
public bool $_keep_alive = true;
public ?int $_ssl_method = null;
public int $_soap_version;
public ?int $_use_proxy = null;
public ?array $_cookies = null;
public ?array $__default_headers = null;
public ?SoapFault $__soap_fault = null;
public ?string $__last_request = null;
public ?string $__last_response = null;
public ?string $__last_request_headers = null;
public ?string $__last_response_headers = null;
public function __construct(?string $wsdl, array $options = []) {}
/** @tentative-return-type */

View File

@@ -1,5 +1,5 @@
/* This is a generated file, edit the .stub.php file instead.
* Stub hash: 2f76351542b32b1bb958f7aee0394fee7d5301be */
* Stub hash: f9ef5d7512d7ff89cf0dd1661ab66db0c52d91bc */
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_use_soap_error_handler, 0, 0, _IS_BOOL, 0)
ZEND_ARG_TYPE_INFO_WITH_DEFAULT_VALUE(0, enable, _IS_BOOL, 0, "true")
@@ -406,6 +406,13 @@ static zend_class_entry *register_class_SoapServer(void)
zend_declare_property_ex(class_entry, property_service_name, &property_service_default_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(property_service_name);
zend_string *property___soap_fault_class_SoapFault = zend_string_init("SoapFault", sizeof("SoapFault")-1, 1);
zval property___soap_fault_default_value;
ZVAL_NULL(&property___soap_fault_default_value);
zend_string *property___soap_fault_name = zend_string_init("__soap_fault", sizeof("__soap_fault") - 1, 1);
zend_declare_typed_property(class_entry, property___soap_fault_name, &property___soap_fault_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property___soap_fault_class_SoapFault, 0, MAY_BE_NULL));
zend_string_release(property___soap_fault_name);
return class_entry;
}
@@ -476,5 +483,162 @@ static zend_class_entry *register_class_SoapClient(void)
zend_declare_property_ex(class_entry, property_httpurl_name, &property_httpurl_default_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(property_httpurl_name);
zval property__login_default_value;
ZVAL_NULL(&property__login_default_value);
zend_string *property__login_name = zend_string_init("_login", sizeof("_login") - 1, 1);
zend_declare_typed_property(class_entry, property__login_name, &property__login_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__login_name);
zval property__password_default_value;
ZVAL_NULL(&property__password_default_value);
zend_string *property__password_name = zend_string_init("_password", sizeof("_password") - 1, 1);
zend_declare_typed_property(class_entry, property__password_name, &property__password_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__password_name);
zval property__use_digest_default_value;
ZVAL_BOOL(&property__use_digest_default_value, 0);
zend_string *property__use_digest_name = zend_string_init("_use_digest", sizeof("_use_digest") - 1, 1);
zend_declare_typed_property(class_entry, property__use_digest_name, &property__use_digest_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
zend_string_release(property__use_digest_name);
zval property__digest_default_value;
ZVAL_NULL(&property__digest_default_value);
zend_string *property__digest_name = zend_string_init("_digest", sizeof("_digest") - 1, 1);
zend_declare_typed_property(class_entry, property__digest_name, &property__digest_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__digest_name);
zval property__proxy_host_default_value;
ZVAL_NULL(&property__proxy_host_default_value);
zend_string *property__proxy_host_name = zend_string_init("_proxy_host", sizeof("_proxy_host") - 1, 1);
zend_declare_typed_property(class_entry, property__proxy_host_name, &property__proxy_host_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__proxy_host_name);
zval property__proxy_port_default_value;
ZVAL_NULL(&property__proxy_port_default_value);
zend_string *property__proxy_port_name = zend_string_init("_proxy_port", sizeof("_proxy_port") - 1, 1);
zend_declare_typed_property(class_entry, property__proxy_port_name, &property__proxy_port_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_NULL));
zend_string_release(property__proxy_port_name);
zval property__proxy_login_default_value;
ZVAL_NULL(&property__proxy_login_default_value);
zend_string *property__proxy_login_name = zend_string_init("_proxy_login", sizeof("_proxy_login") - 1, 1);
zend_declare_typed_property(class_entry, property__proxy_login_name, &property__proxy_login_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__proxy_login_name);
zval property__proxy_password_default_value;
ZVAL_NULL(&property__proxy_password_default_value);
zend_string *property__proxy_password_name = zend_string_init("_proxy_password", sizeof("_proxy_password") - 1, 1);
zend_declare_typed_property(class_entry, property__proxy_password_name, &property__proxy_password_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__proxy_password_name);
zval property__exceptions_default_value;
ZVAL_BOOL(&property__exceptions_default_value, 1);
zend_string *property__exceptions_name = zend_string_init("_exceptions", sizeof("_exceptions") - 1, 1);
zend_declare_typed_property(class_entry, property__exceptions_name, &property__exceptions_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
zend_string_release(property__exceptions_name);
zval property__encoding_default_value;
ZVAL_NULL(&property__encoding_default_value);
zend_string *property__encoding_name = zend_string_init("_encoding", sizeof("_encoding") - 1, 1);
zend_declare_typed_property(class_entry, property__encoding_name, &property__encoding_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__encoding_name);
zval property__classmap_default_value;
ZVAL_NULL(&property__classmap_default_value);
zend_string *property__classmap_name = zend_string_init("_classmap", sizeof("_classmap") - 1, 1);
zend_declare_typed_property(class_entry, property__classmap_name, &property__classmap_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY|MAY_BE_NULL));
zend_string_release(property__classmap_name);
zval property__features_default_value;
ZVAL_NULL(&property__features_default_value);
zend_string *property__features_name = zend_string_init("_features", sizeof("_features") - 1, 1);
zend_declare_typed_property(class_entry, property__features_name, &property__features_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_NULL));
zend_string_release(property__features_name);
zval property__connection_timeout_default_value;
ZVAL_LONG(&property__connection_timeout_default_value, 0);
zend_string *property__connection_timeout_name = zend_string_init("_connection_timeout", sizeof("_connection_timeout") - 1, 1);
zend_declare_typed_property(class_entry, property__connection_timeout_name, &property__connection_timeout_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
zend_string_release(property__connection_timeout_name);
zval property__stream_context_default_value;
ZVAL_NULL(&property__stream_context_default_value);
zend_string *property__stream_context_name = zend_string_init("_stream_context", sizeof("_stream_context") - 1, 1);
zend_declare_property_ex(class_entry, property__stream_context_name, &property__stream_context_default_value, ZEND_ACC_PUBLIC, NULL);
zend_string_release(property__stream_context_name);
zval property__user_agent_default_value;
ZVAL_NULL(&property__user_agent_default_value);
zend_string *property__user_agent_name = zend_string_init("_user_agent", sizeof("_user_agent") - 1, 1);
zend_declare_typed_property(class_entry, property__user_agent_name, &property__user_agent_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property__user_agent_name);
zval property__keep_alive_default_value;
ZVAL_BOOL(&property__keep_alive_default_value, 1);
zend_string *property__keep_alive_name = zend_string_init("_keep_alive", sizeof("_keep_alive") - 1, 1);
zend_declare_typed_property(class_entry, property__keep_alive_name, &property__keep_alive_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_BOOL));
zend_string_release(property__keep_alive_name);
zval property__ssl_method_default_value;
ZVAL_NULL(&property__ssl_method_default_value);
zend_string *property__ssl_method_name = zend_string_init("_ssl_method", sizeof("_ssl_method") - 1, 1);
zend_declare_typed_property(class_entry, property__ssl_method_name, &property__ssl_method_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_NULL));
zend_string_release(property__ssl_method_name);
zval property__soap_version_default_value;
ZVAL_UNDEF(&property__soap_version_default_value);
zend_string *property__soap_version_name = zend_string_init("_soap_version", sizeof("_soap_version") - 1, 1);
zend_declare_typed_property(class_entry, property__soap_version_name, &property__soap_version_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
zend_string_release(property__soap_version_name);
zval property__use_proxy_default_value;
ZVAL_NULL(&property__use_proxy_default_value);
zend_string *property__use_proxy_name = zend_string_init("_use_proxy", sizeof("_use_proxy") - 1, 1);
zend_declare_typed_property(class_entry, property__use_proxy_name, &property__use_proxy_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG|MAY_BE_NULL));
zend_string_release(property__use_proxy_name);
zval property__cookies_default_value;
ZVAL_NULL(&property__cookies_default_value);
zend_string *property__cookies_name = zend_string_init("_cookies", sizeof("_cookies") - 1, 1);
zend_declare_typed_property(class_entry, property__cookies_name, &property__cookies_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY|MAY_BE_NULL));
zend_string_release(property__cookies_name);
zval property___default_headers_default_value;
ZVAL_NULL(&property___default_headers_default_value);
zend_string *property___default_headers_name = zend_string_init("__default_headers", sizeof("__default_headers") - 1, 1);
zend_declare_typed_property(class_entry, property___default_headers_name, &property___default_headers_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_ARRAY|MAY_BE_NULL));
zend_string_release(property___default_headers_name);
zend_string *property___soap_fault_class_SoapFault = zend_string_init("SoapFault", sizeof("SoapFault")-1, 1);
zval property___soap_fault_default_value;
ZVAL_NULL(&property___soap_fault_default_value);
zend_string *property___soap_fault_name = zend_string_init("__soap_fault", sizeof("__soap_fault") - 1, 1);
zend_declare_typed_property(class_entry, property___soap_fault_name, &property___soap_fault_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_CLASS(property___soap_fault_class_SoapFault, 0, MAY_BE_NULL));
zend_string_release(property___soap_fault_name);
zval property___last_request_default_value;
ZVAL_NULL(&property___last_request_default_value);
zend_string *property___last_request_name = zend_string_init("__last_request", sizeof("__last_request") - 1, 1);
zend_declare_typed_property(class_entry, property___last_request_name, &property___last_request_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property___last_request_name);
zval property___last_response_default_value;
ZVAL_NULL(&property___last_response_default_value);
zend_string *property___last_response_name = zend_string_init("__last_response", sizeof("__last_response") - 1, 1);
zend_declare_typed_property(class_entry, property___last_response_name, &property___last_response_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property___last_response_name);
zval property___last_request_headers_default_value;
ZVAL_NULL(&property___last_request_headers_default_value);
zend_string *property___last_request_headers_name = zend_string_init("__last_request_headers", sizeof("__last_request_headers") - 1, 1);
zend_declare_typed_property(class_entry, property___last_request_headers_name, &property___last_request_headers_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property___last_request_headers_name);
zval property___last_response_headers_default_value;
ZVAL_NULL(&property___last_response_headers_default_value);
zend_string *property___last_response_headers_name = zend_string_init("__last_response_headers", sizeof("__last_response_headers") - 1, 1);
zend_declare_typed_property(class_entry, property___last_response_headers_name, &property___last_response_headers_default_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_STRING|MAY_BE_NULL));
zend_string_release(property___last_response_headers_name);
return class_entry;
}

View File

@@ -17,7 +17,7 @@ $dummy = unserialize('O:12:"MySoapClient":5:{s:3:"uri";s:1:"a";s:8:"location";s:
$dummy->whatever();
?>
--EXPECTF--
Fatal error: Uncaught TypeError: Cannot assign string to property SoapClient::$trace of type bool in %s:%d
Fatal error: Uncaught TypeError: Cannot assign int to property SoapClient::$__default_headers of type ?array in %s:%d
Stack trace:
#0 %s(%d): unserialize('O:12:"MySoapCli...')
#1 {main}