As a result now it is possible to use certificates during access WSDL files.
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();
}
namelen = spprintf(&name, 0, "%s://%s:%d", (use_ssl && !*use_proxy)? "ssl" : "tcp", host, port);
- if (use_ssl) {
- zval **tmp;
-
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_local_cert", sizeof("_local_cert"), (void **) &tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING) {
- php_stream_context_set_option(context, "ssl", "local_cert", *tmp);
- if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_passphrase", sizeof("_passphrase"), (void **) &tmp) == SUCCESS &&
- Z_TYPE_PP(tmp) == IS_STRING) {
- php_stream_context_set_option(context, "ssl", "passphrase", *tmp);
- }
- }
- }
+
stream = php_stream_xport_create(name, namelen,
ENFORCE_SAFE_MODE | REPORT_ERRORS,
STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT,
char* old_error_code = SOAP_GLOBAL(error_code);
int uri_len;
php_stream_context *context=NULL;
- zval **proxy_host, **proxy_port, *orig_context, *new_context;
+ zval **tmp, **proxy_host, **proxy_port, *orig_context, *new_context;
smart_str headers = {0};
+ 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);
+ }
+
if (zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_host", sizeof("_proxy_host"), (void **) &proxy_host) == SUCCESS &&
Z_TYPE_PP(proxy_host) == IS_STRING &&
zend_hash_find(Z_OBJPROP_P(this_ptr), "_proxy_port", sizeof("_proxy_port"), (void **) &proxy_port) == SUCCESS &&
ZVAL_STRING(str_proxy, proxy.c, 1);
smart_str_free(&proxy);
- context = php_stream_context_alloc();
+ if (!context) {
+ context = php_stream_context_alloc();
+ }
php_stream_context_set_option(context, "http", "proxy", str_proxy);
zval_ptr_dtor(&str_proxy);
zval *wsdl;
zval *options = NULL;
int soap_version = SOAP_1_1;
+ php_stream_context *context = NULL;
SOAP_CLIENT_BEGIN_CODE();
if (zend_hash_find(ht, "stream_context", sizeof("stream_context"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_RESOURCE) {
- php_stream_context *context = php_stream_context_from_zval(*tmp, 1);
- if (context) {
- add_property_resource(this_ptr, "_stream_context", context->rsrc_id);
- }
+ context = php_stream_context_from_zval(*tmp, 1);
}
if (zend_hash_find(ht, "location", sizeof("location"), (void**)&tmp) == SUCCESS &&
}
if (zend_hash_find(ht, "local_cert", sizeof("local_cert"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
- add_property_stringl(this_ptr, "_local_cert", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
+ if (!context) {
+ context = php_stream_context_alloc();
+ }
+ php_stream_context_set_option(context, "ssl", "local_cert", *tmp);
if (zend_hash_find(ht, "passphrase", sizeof("passphrase"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_STRING) {
- add_property_stringl(this_ptr, "_passphrase", Z_STRVAL_PP(tmp), Z_STRLEN_PP(tmp), 1);
+ php_stream_context_set_option(context, "ssl", "passphrase", *tmp);
}
}
if (zend_hash_find(ht, "trace", sizeof("trace"), (void**)&tmp) == SUCCESS &&
Z_TYPE_PP(tmp) == IS_LONG && Z_LVAL_PP(tmp) > 0) {
add_property_long(this_ptr, "_connection_timeout", Z_LVAL_PP(tmp));
}
+
+ if (context) {
+ add_property_resource(this_ptr, "_stream_context", context->rsrc_id);
+ }
+
} else if (wsdl == NULL) {
php_error_docref(NULL TSRMLS_CC, E_ERROR, "'location' and 'uri' options are requred in nonWSDL mode");
return;